mirror of
https://github.com/overleaf/overleaf.git
synced 2024-12-29 12:13:32 +00:00
21 lines
708 B
CoffeeScript
21 lines
708 B
CoffeeScript
settings = require('settings-sharelatex')
|
|
TpdsPollingBackgroundTasks = require("./app/js/Features/ThirdPartyDataStore/TpdsPollingBackgroundTasks")
|
|
|
|
time =
|
|
oneHour : 60 * 60 * 1000
|
|
fifteenMinutes : 15 * 60 * 1000
|
|
thirtySeconds : 30 * 1000
|
|
betweenThirtyAndFiveHundredSeconds: =>
|
|
random = Math.floor(Math.random() * 500) * 1000
|
|
if random < time.thirtySeconds
|
|
return time.betweenThirtyAndFiveHundredSeconds()
|
|
else
|
|
return random
|
|
|
|
runPeriodically = (funcToRun, periodLength)->
|
|
recursiveReference = ->
|
|
funcToRun ->
|
|
setTimeout recursiveReference, periodLength
|
|
setTimeout recursiveReference, 0
|
|
|
|
runPeriodically ((cb) -> TpdsPollingBackgroundTasks.pollUsersWithDropbox(cb)), time.fifteenMinutes
|