Displaying 1 result from an estimated 1 matches for "mutext".
Did you mean:
mutex
2006 Jul 06
6
Mutex::Synchronize with backgroundrb
...f the code blacks passed to this function in
a queue. This make sure that code gets ran one at a time. This is
required when doing any kind of database activity in backgrondrb and
multiple threads. Otherwise I lose the connection to my database.
So here is my question:
Do I need to do:
@lock = Mutext.new
And do this for EVERY database interaction WITHIN background rb:
@lock.synchronize do
#some db activity, like model.save!, model.find, anything that
queries the db
end
Or do I need to wrap ALL database activity in a sychronize method?
Including various database activity in my controllers...