search for: queue_sleep_time

Displaying 1 result from an estimated 1 matches for "queue_sleep_time".

2008 Mar 18
1
Polling is REALLY slow
...My first thought was to create a worker that polled for records with the correct state, but it doesn''t work as expected. Here is what I have with error checking, etc. removed: class RequestQueuePollerWorker < BackgrounDRb::MetaWorker set_worker_name :request_queue_poller_worker QUEUE_SLEEP_TIME = 30 # seconds def create(args = nil) @running = true self.poll_queue end def build_all_matches(args = nil) thread_pool.defer(args) do |args| requests = Request.find_active(:all) requests.each { |request| request.queue! } # using acts_as_state_machine end...