diff --git a/routes/_actions/addStatusOrNotification.js b/routes/_actions/addStatusOrNotification.js index aa5acd7..e22de40 100644 --- a/routes/_actions/addStatusOrNotification.js +++ b/routes/_actions/addStatusOrNotification.js @@ -5,6 +5,7 @@ import { store } from '../_store/store' import { scheduleIdleTask } from '../_utils/scheduleIdleTask' import uniqBy from 'lodash/uniqBy' import uniq from 'lodash/uniq' +import { isMobile } from '../_utils/isMobile' function getExistingItemIdsSet (instanceName, timelineName) { let timelineItemIds = store.getForTimeline(instanceName, timelineName, 'timelineItemIds') || [] @@ -70,10 +71,11 @@ async function processFreshUpdates (instanceName, timelineName) { } const lazilyProcessFreshUpdates = throttle((instanceName, timelineName) => { - scheduleIdleTask(() => { + const runTask = isMobile() ? scheduleIdleTask : requestAnimationFrame + runTask(() => { /* no await */ processFreshUpdates(instanceName, timelineName) }) -}, 5000) +}, 3000) export function addStatusOrNotification (instanceName, timelineName, newStatusOrNotification) { addStatusesOrNotifications(instanceName, timelineName, [newStatusOrNotification]) diff --git a/routes/_actions/streaming.js b/routes/_actions/streaming.js index 56337aa..2984181 100644 --- a/routes/_actions/streaming.js +++ b/routes/_actions/streaming.js @@ -1,5 +1,4 @@ import { TimelineStream } from '../_api/TimelineStream' -import { scheduleIdleTask } from '../_utils/scheduleIdleTask' import { mark, stop } from '../_utils/marks' import { deleteStatus } from './deleteStatuses' import { addStatusOrNotification } from './addStatusOrNotification' @@ -29,9 +28,7 @@ export function createStream (streamingApi, instanceName, accessToken, console.error("don't know how to handle event", msg) return } - scheduleIdleTask(() => { - processMessage(instanceName, timelineName, msg) - }) + processMessage(instanceName, timelineName, msg) }, onOpen () { if (onOpenStream) {