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

Swappable redis configuration #94

Closed robacarp closed 2 years ago

robacarp commented 2 years ago

This is a proof-of-concept for how the redis connection dependency could be injected rather than constructed.

Benefits:

Drawbacks:

jwoertink commented 2 years ago

Just ran in to an issue which could affect how this is thought of. Being able to swap out the redis config for something else is nice, but if Mosquito keeps the default built-in, you'd have to have some sort of redis shard as a dependency. This seems to cause conflics with other shards that may include a different redis shard (https://github.com/cable-cr/cable/issues/46#issuecomment-1187963323)

If you went with a swappable config, you'd probably have to create a separate shard for "out of the box" functionality like:

mosquito:
  github: mosquito-cr/mosquito
mosquito_backend:
  github: mosquito-cr/redis_backend

And the users would have to require that separately in order to be able to swap that out. If you kept the stefanwille redis shard in, then anyone using Mosquito would be required to use that shard interface anyway