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

config object to set redis connection / url #3

Closed robacarp closed 4 years ago

robacarp commented 6 years ago

https://github.com/robacarp/mosquito/blob/515fad360820ac8b961555ab6f0e3c07de7df6bf/src/mosquito/redis.cr#L34-L40

These lines shouldn't attempt to connect to redis directly, but read from a configuration object with default values.

duraki commented 6 years ago

Any update on this? I'm having troubles connecting over URL through :36, getting:

Unhandled exception: Errno: connect: Cannot assign requested address (Redis::CannotConnectError)

Using proper connection string redis://cache:6379/4, and for which Redis instance seems usable by open-source library Crecto. Any reason for this? Application is run in docker.

$ docker ps
CONTAINER ID        IMAGE               COMMAND                  CREATED             STATUS              PORTS                    NAMES
838a43ccae0d        my_pkg          "/bin/bash"              47 hours ago        Up 8 hours          0.0.0.0:3000->3000/tcp   my_pkg_1
60641bf0b38d        redis               "docker-entrypoint.s…"   47 hours ago        Up 8 hours          6379/tcp                 my_redis_1
robacarp commented 6 years ago

@duraki are you setting the Connection string via env var? I don’t see any reason here why that wouldn’t work

duraki commented 6 years ago

Strange. Seems like it works now; after rebooting my system. Still, would love to see this implemented, will try to send a PR soon.

robacarp commented 4 years ago

fixed by #51