Do auto-checking when last check timestamp is from the future or a non-number. #1164
This commit is contained in:
parent
e442da202a
commit
bc3099caa7
@ -9,7 +9,9 @@ Redirect =
|
||||
|
||||
init: ->
|
||||
@selectArchives()
|
||||
@update() if Conf['archiveAutoUpdate'] and Conf['lastarchivecheck'] < Date.now() - 2 * $.DAY
|
||||
if Conf['archiveAutoUpdate']
|
||||
now = Date.now()
|
||||
@update() unless now - 2 * $.DAY < Conf['lastarchivecheck'] <= now
|
||||
|
||||
selectArchives: ->
|
||||
o =
|
||||
|
||||
@ -2,7 +2,8 @@ BoardConfig =
|
||||
cbs: []
|
||||
|
||||
init: ->
|
||||
if (Conf['boardConfig'].lastChecked or 0) < Date.now() - 2 * $.HOUR
|
||||
now = Date.now()
|
||||
unless now - 2 * $.HOUR < (Conf['boardConfig'].lastChecked or 0) <= now
|
||||
$.ajax '//a.4cdn.org/boards.json',
|
||||
onloadend: @load
|
||||
else
|
||||
|
||||
@ -178,7 +178,7 @@ ThreadWatcher =
|
||||
{db} = ThreadWatcher
|
||||
interval = if ThreadWatcher.unreadEnabled and Conf['Show Unread Count'] then 5 * $.MINUTE else 2 * $.HOUR
|
||||
now = Date.now()
|
||||
if now >= (db.data.lastChecked or 0) + interval
|
||||
unless now - interval < (db.data.lastChecked or 0) <= now
|
||||
ThreadWatcher.fetchAllStatus() # calls forceSync
|
||||
db.data.lastChecked = now
|
||||
db.save()
|
||||
|
||||
@ -84,7 +84,7 @@ class DataBoard
|
||||
@deleteIfEmpty {boardID}
|
||||
|
||||
now = Date.now()
|
||||
if (@data.lastChecked or 0) < now - 2 * $.HOUR
|
||||
unless now - 2 * $.HOUR < (@data.lastChecked or 0) <= now
|
||||
@data.lastChecked = now
|
||||
for boardID of @data.boards
|
||||
@ajaxClean boardID
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user