Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

[Messenger] Fix redis Connection::get() should be non blocking by default #31545

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
May 21, 2019

Conversation

chalasr
Copy link
Member

@chalasr chalasr commented May 19, 2019

Q A
Branch? 4.3
Bug fix? yes
New feature? no
BC breaks? no
Deprecations? no
Tests pass? yes
Fixed tickets n/a
License MIT
Doc PR todo

The \Redis::xreadgroup() method waits until a message arrives or the specified timeout is reached before returning, which means that RedisExt\Connection::get() is blocking.
That's inconsistent with other transports which all returns immediately in case there is no message, for instance the AMQP transport uses \Amqp::get() instead of \Amqp::consume() for this reason.
It also short-circuits the worker's stop logic: both the --time-limit option of the messenger:consume command and the messenger:stop-workers don't work with the redis transport.
This returns early in case the message count is 0 and no blocking timeout has been configured.

@chalasr chalasr force-pushed the redis-non-blocking-reads branch from a64ef8e to 454a738 Compare May 19, 2019 16:26
@chalasr
Copy link
Member Author

chalasr commented May 19, 2019

ping @alexander-schranz also :)

@chalasr chalasr force-pushed the redis-non-blocking-reads branch 4 times, most recently from 705b6f8 to 81136e7 Compare May 19, 2019 17:47
Copy link
Contributor

@alexander-schranz alexander-schranz left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

xReadGroup should be non blocking aslong as we don't give a block time. Did I implement there something false?

And as written the xlen I think is the false way to get the correct count value as this does also include pending and received messages.

Copy link
Contributor

@alexander-schranz alexander-schranz left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As discussed on slack this seems currently the only way to avoid a blocking request to omit the blocking parameter of xreadgroup function.

@chalasr thank you for fixing this 👍

@chalasr chalasr force-pushed the redis-non-blocking-reads branch from f478351 to 229502a Compare May 21, 2019 02:47
@fabpot
Copy link
Member

fabpot commented May 21, 2019

Thank you @chalasr.

@fabpot fabpot merged commit 229502a into symfony:4.3 May 21, 2019
fabpot added a commit that referenced this pull request May 21, 2019
…king by default (chalasr)

This PR was merged into the 4.3 branch.

Discussion
----------

[Messenger] Fix redis Connection::get() should be non blocking by default

| Q             | A
| ------------- | ---
| Branch?       | 4.3
| Bug fix?      | yes
| New feature?  | no
| BC breaks?    | no
| Deprecations? | no
| Tests pass?   | yes
| Fixed tickets | n/a
| License       | MIT
| Doc PR        | todo

The `\Redis::xreadgroup()` method waits until a message arrives or the specified timeout is reached before returning, which means that `RedisExt\Connection::get()` is blocking.
That's inconsistent with other transports which all returns immediately in case there is no message, for instance the AMQP transport uses `\Amqp::get()` instead of `\Amqp::consume()` for this reason.
It also short-circuits the worker's stop logic: both the `--time-limit` option of the `messenger:consume` command and the `messenger:stop-workers` don't work with the redis transport.
This returns early in case the message count is 0 and no blocking timeout has been configured.

Commits
-------

229502a [Messenger] Make redis Connection::get() non blocking by default
@chalasr chalasr deleted the redis-non-blocking-reads branch May 21, 2019 08:26
@fabpot fabpot mentioned this pull request May 22, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants
Morty Proxy This is a proxified and sanitized view of the page, visit original site.