mosquito-cr / mosquito

A background task runner for crystal applications supporting periodic (CRON) and manually queued jobs
MIT License
227 stars 24 forks source link

adds a setting to whitelist the runnable queues for a worker #63

Closed robacarp closed 3 years ago

robacarp commented 3 years ago

fixes #2

When running a worker it's not unreasonable to want to restrict the queues from which it'll execute tasks. This provides a setting which allows whitelisting queue names for monitoring:

Mosquito.configure do |settings|
  settings.run_from = ["slow_queries"]
end

The setting default is [] which translates to "run everything". I deliberately didn't implement the spec proposed in #2 to use a regex to filter the queue name because it seems like overkill. I can't imagine a scenario where there are enough queues where filtering explicitly is a configuration maintenance burden.

robacarp commented 3 years ago

@emanzx let me know if this will address your execution filtering needs