rails/solid_queue

Support for dynamic limits on concurrency

Opened this issue · 0 comments

Right now, key generate accepts a callable, whereas the to setting for the limit is static.

It looks like it would be pretty easy to make that dynamic the same way that the key is.

Would you be open to a PR making that change?

2 notes:

  1. A good example motivating use case is SLAs. Premium customers get 2x the number of jobs allowed as standard customers. A second (the one we have) is that we call out to external databases of our customers, and those DBs have different capacity levels, so some could support 1000 jobs at once while some would fall over at 50.
  2. I know this could create an issue where the same key could have different limits set by different jobs. I would argue that is a "document and accept it" situation where developers can be warned that it should be the same value for any instances of the same key, and that otherwise the behavior is unpredictable.