Curious: Why do queue listeners poll Redis and not use the "Subscribe" function of Redis to listen for newly dispatched jobs? #40657
Unanswered
travisaustin
asked this question in
General
Replies: 1 comment
-
I found this StackOverflow that reveals that if you've subcribed in a Redis connection, that connection can't be used for anything else. I wonder if maybe this is whay Laravel doesn't use |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
Basically, the title.
I use Horizon, but I believe this pertains to "stock" Laravel queues as well.
Basically, the worker process polls Redis periodically (every 1 second, for example) to find out if there are any jobs available to be processed. Redis has a "subscribe" feature that allows a remote system to connect and be immediately informed of newly-available jobs.
I'm curious: why does Laravel poll Redis and not use the Subscribe function? The Subscribe function seems like it's an exact match for Laravel's use-case, and it seems to me like a more elegant way to do it than to poll.
Again, I'm just curious.
Thanks!
Beta Was this translation helpful? Give feedback.
All reactions