Displaying 1 result from an estimated 1 matches for "time_to_process".
2007 Nov 21
2
Is fork { } safe inside of a worker? How else may this be done...
I have a BackgrounDRb worker running every 2 minutes. Here''s the basic idea:
- events = Event.find_all_pending( 2.minutes )
- while( all events have yet to be processed )
---- if( Time.now <= event.time_to_process )
------- fork { process_event }
--- end
--- sleep( 0.25 )
- end
- puts "Done..."
Events that need to be processed within the next 2 minutes are loaded and
iterated over. If its time to process the event, fork and do so. Sleep for
0.25 seconds between loops until all events have been pro...