Tuesday, December 05, 2006

deadlocks and ActiveRecord

According to this ActiveRecord is thread-safe. Turns out that I have some code for multithreaded identifier generation and since the seed is from the db, I must have thread-safe db interaction through ActiveRecord. My tests kept puking with deadlocks and I narrowed it down to the save/destroy operations on the model. Found this post which contained my answer:

ActiveRecord::Base.allow_concurrency = true

The kicker here is that this is never mentioned in the API docs...

No comments: