QueueClassic/queue_classic

Proposed schema changes

smathieu opened this issue · 2 comments

I'd like to propose that we make the following change to the schema and the DDL. This change should probably happen in the next major release, since it would force all users to update their schema.

I'd like to remove the default value from scheduled_at and made it that non-scheduled work would have scheduled_at = NULL. The lock_head method would then need to be changed to pick up jobs that are not scheduled OR that are due to be processed.

The main reason for this change is to make monitoring QC easier. We have a lot of metrics on our queue the gets push to our monitoring service (Librato). This code is available here https://github.com/rainforestapp/queue_classic_plus/blob/master/lib/queue_classic_plus/update_metrics.rb

The main issue we have is that we want to monitor scheduled jobs differently than non-schedule jobs. One thing we look at is the age of the oldest job in the queue. If the job was enqueued to be processed instantly, we want to make sure that it takes a small amount of time for it to process. Basically, we want to make sure that our queue doesn't grow too big or that something isn't stuck in there.

Sure, we can achieve all of this with current schema, but it feels hacky. I think it's useful to be able to differentiate between a scheduled job and a non-scheduled job easily.

I can't think of any downside this new schema would have, other than forcing users to update their schema.

no objections here.

If we get a smooth upgrade path, for example if QC denies working unless you have the right schema, I'm on board with this change.

I'm onboard with that.