REDIS_CONNECTION example works, unless you don't have redis server running #2522
str11ngfello
started this conversation in
General
Replies: 1 comment 1 reply
-
btw, the cli command doesn't finish and repeatedly waits for redis to connect. This is why it's a blocker. If it weren't a hang it might be okay with me. But it's blocking the command from running. Of course I can fire up a local redis docker container and get by, but my CI environment won't have a redis server to connect so it'll fail in that case. |
Beta Was this translation helpful? Give feedback.
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
I've been using tsed.io's ioredis intergration for almost a year. The docs say to do this:
And then you can inject in your other code like this:
As long as you have a redis server running of course.
However, recently I created a tsed cli command to generate types (found that in another dicussion here) and that command passes in a blank object for redis like so:
All this was fine, as long as redis is running. But the cli command just generates types so when I run it in an environment without redis the command repeated trys to connect to redis :D
I Think it's because the way the sample code works for REDIS_CONNECTION provide. It looks like the ioredis Redis object will start a connection just by instantiating it.
How can I modify the sample REDIS_CONNECTION provider to be smart enough to know that I firing up a command and it should not let iosredis try to connect. I saw ioredis has a "lazyConnect" option but am unsure how to use that with this code:
I hope I'm close but just missing something. Anyone have any ideas?
Beta Was this translation helpful? Give feedback.
All reactions