[nodejs] Re: How would you do this: schedule events

2012-12-16 Thread mscdex
On Dec 16, 8:53 am, Filipe wrote: > What's the clever way to do this? Well, probably the easiest way would be to compute the difference between the UNIX timestamps (in seconds) and do a setTimeout with a timeout value of that difference (multiplied by 1000 to convert to milliseconds). -- Job Bo

[nodejs] Re: How would you do this: schedule events

2012-12-16 Thread Jonathan Dickinson
If you care about failure resilience at all: 1. You will need a pseudoqueue in SQL (or whatever) with a datetime field indicating when the event needs to fire. 2. Every, say, 5 minutes (settimeout) query SQL for anything that needs to happen in the next, say, 6 minutes. 3. Calculate the differen

[nodejs] Re: How would you do this: schedule events

2012-12-16 Thread Brian Link
Could be done in redis also, with a sorted set, where the values are json payloads of task data and the scores are timestamps. On an interval (like Jonathan suggested) you could do a query for all items older than 'now' and start processing them. On Sunday, December 16, 2012 12:12:11 PM UTC-8,

Re: [nodejs] Re: How would you do this: schedule events

2012-12-16 Thread Alan Gutierrez
On 12/16/12 12:47 PM, mscdex wrote: On Dec 16, 8:53 am, Filipe wrote: What's the clever way to do this? Well, probably the easiest way would be to compute the difference between the UNIX timestamps (in seconds) and do a setTimeout with a timeout value of that difference (multiplied by 1000 to