aboutsummaryrefslogtreecommitdiff
path: root/src/services/timeline_fetcher/timeline_fetcher.service.js
diff options
context:
space:
mode:
authorShpuld Shpludson <shp@cock.li>2020-10-01 13:20:14 +0000
committerShpuld Shpludson <shp@cock.li>2020-10-01 13:20:14 +0000
commit6bd38c7d6f3b0bf7cd1bdb6f6dcb49492491c562 (patch)
tree9a4e136d71747188ae455954ab7b620a352f4b86 /src/services/timeline_fetcher/timeline_fetcher.service.js
parent68c2a5b18f887f3db2f5685953bc5175aaaabbd3 (diff)
parente331db79e50d4056cf61baa5ece88ad74e7e7fcf (diff)
Merge branch 'fix/wait-for-request-before-starting-interval' into 'develop'
Fix/wait for request before starting interval - fix #937 Closes #937 See merge request pleroma/pleroma-fe!1222
Diffstat (limited to 'src/services/timeline_fetcher/timeline_fetcher.service.js')
-rw-r--r--src/services/timeline_fetcher/timeline_fetcher.service.js6
1 files changed, 4 insertions, 2 deletions
diff --git a/src/services/timeline_fetcher/timeline_fetcher.service.js b/src/services/timeline_fetcher/timeline_fetcher.service.js
index d0cddf84..72ea4890 100644
--- a/src/services/timeline_fetcher/timeline_fetcher.service.js
+++ b/src/services/timeline_fetcher/timeline_fetcher.service.js
@@ -1,6 +1,7 @@
import { camelCase } from 'lodash'
import apiService from '../api/api.service.js'
+import { promiseInterval } from '../promise_interval/promise_interval.js'
const update = ({ store, statuses, timeline, showImmediately, userId, pagination }) => {
const ccTimeline = camelCase(timeline)
@@ -71,8 +72,9 @@ const startFetching = ({ timeline = 'friends', credentials, store, userId = fals
const showImmediately = timelineData.visibleStatuses.length === 0
timelineData.userId = userId
fetchAndUpdate({ timeline, credentials, store, showImmediately, userId, tag })
- const boundFetchAndUpdate = () => fetchAndUpdate({ timeline, credentials, store, userId, tag })
- return setInterval(boundFetchAndUpdate, 10000)
+ const boundFetchAndUpdate = () =>
+ fetchAndUpdate({ timeline, credentials, store, userId, tag })
+ return promiseInterval(boundFetchAndUpdate, 10000)
}
const timelineFetcher = {
fetchAndUpdate,