RubyFlow The Ruby and Rails community linklog

×

The Ruby and Rails community linklog

Made a library? Written a blog post? Found a useful tutorial? Share it with the Ruby community here or just enjoy what everyone else has found!

How Solid Queue uses a semaphore

Solid Queue’s limits_concurrency keeps a semaphore as a database row. I traced it through the 1.4.0 source: blocked jobs wait as rows in a table instead of holding a worker thread, a permit is taken when the job is admitted to the ready queue (not when it starts running), and permits expire. The row doesn’t record which job holds a permit. So a job that runs past its duration can, when it finishes, send a late signal that lets two other jobs overlap under a limit of one. A small script reproduces it. The post ends with how to size duration and why concurrency limits don’t replace protection at the write: How Solid Queue uses a semaphore.

Post a comment

You can use basic HTML markup (e.g. <a>) or Markdown.

As you are not logged in, you will be
directed via GitHub to signup or sign in