aboutsummaryrefslogtreecommitdiff
path: root/src/services/timeline_fetcher/timeline_fetcher.service.js
diff options
context:
space:
mode:
authorShpuld Shpuldson <shp@cock.li>2020-09-02 20:40:47 +0300
committerShpuld Shpuldson <shp@cock.li>2020-09-02 20:40:47 +0300
commit2d914c331eea5f5b9036e10ef3d937628891b9e1 (patch)
treefaee1fb83a9d71e4f43a4e8ea4232c2cf543b84d /src/services/timeline_fetcher/timeline_fetcher.service.js
parentacc45b49a55a5c173abdeac8c89d16395f92bc01 (diff)
replace setInterval for timelne, notifications and follow requests
Diffstat (limited to 'src/services/timeline_fetcher/timeline_fetcher.service.js')
-rw-r--r--src/services/timeline_fetcher/timeline_fetcher.service.js7
1 files changed, 4 insertions, 3 deletions
diff --git a/src/services/timeline_fetcher/timeline_fetcher.service.js b/src/services/timeline_fetcher/timeline_fetcher.service.js
index d0cddf84..8bbec2c7 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 { makeFetcher } from '../fetcher/fetcher.js'
const update = ({ store, statuses, timeline, showImmediately, userId, pagination }) => {
const ccTimeline = camelCase(timeline)
@@ -70,9 +71,9 @@ const startFetching = ({ timeline = 'friends', credentials, store, userId = fals
const timelineData = rootState.statuses.timelines[camelCase(timeline)]
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, showImmediately, userId, tag })
+ return makeFetcher(boundFetchAndUpdate, 10000)
}
const timelineFetcher = {
fetchAndUpdate,