Displaying 2 results from an estimated 2 matches for "status_mutex".
2007 Dec 19
6
thread_pooling sleeping
I''m trying to run a single worker that could perform a periodic task
for a given user.
>From a controller, I imagine something like:
def start_job
MiddleMan.ask_work(:worker => :foo_worker, :worker_method => :perform_task,
:data => { :user_id = current_user.id })
end
def check_job
@status = MiddleMan.ask_status(:worker => :foo_worker)[current_user.id]
end
2008 May 09
1
register_status for excess thread_pool?
...register_status. This works fine:
def makepdf(user)
txt = user.to_s + " started"
save_status(user, :progress, txt)
do_report(user)
txt = user.to_s + " ended"
save_status(user, :progress, txt)
end
def save_status(user_id,key,data)
@status_mutex.synchronize do
@worker_status[user_id] = { :key => key, :data => data}
end
register_status(@worker_status)
end
However, if more than 10 requests are submitted to the worker
at a time, those in excess of 10 are queued and thus never
get assigned a status in register_status. S...