←back to thread

setBigTimeout

(evanhahn.com)
210 points cfj | 2 comments | | HN request time: 0s | source
Show context
sjaak ◴[] No.41880845[source]
What is the use-case for such a function?
replies(3): >>41880863 #>>41880877 #>>41881064 #
keithwhor ◴[] No.41880877[source]
Off the top of my head, a cron scheduler for a server that reads from a database and sets a timeout upon boot. Every time the server is reboot the timeouts are reinitialized (fail safe in case of downtime). If upon boot there’s a timeout > 25 days it’ll get executed immediately which is not the behavior you want.
replies(2): >>41881778 #>>41882349 #
1. skykooler ◴[] No.41881778[source]
Why would you do that in JS rather than just using cron for it?
replies(1): >>41895034 #
2. efilife ◴[] No.41895034[source]
It can be quicker since you are in the environment already and you are sure that they will activate only when your program is running