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] Make Redis messages countable #46229

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
Jul 20, 2022

Conversation

Jean-Beru
Copy link
Contributor

Q A
Branch? 6.1
Bug fix? no
New feature? no
Deprecations? no
Tickets
License MIT
Doc PR

Each Messenger Transport can return the number of messages present in the queue. For example, when we use the messenger:failed:retry command, Messenger displays the number of messages to retry.

Actually, this count is not displayed when using RedisTransport. This PR adds this functionality.

@carsonbot carsonbot added this to the 6.1 milestone May 2, 2022
@Jean-Beru Jean-Beru force-pushed the messenger/redis-message-count-aware branch from 4c0b6be to cfdf9ce Compare May 2, 2022 11:40
@chalasr
Copy link
Member

chalasr commented May 2, 2022

Getting the actual message count might be more complicated: #39127.
/cc @alexander-schranz fyi

@chalasr chalasr modified the milestones: 6.1, 6.2 May 2, 2022
@alexander-schranz
Copy link
Contributor

alexander-schranz commented May 2, 2022

@chalasr yes xlen does not represent the number which somebody would expect. It requires another logic. See comment here: #31545 (comment). I know that xinfo format changed between versions of the php redis extension, so it is not easy task here. So there need to be checked how to implement this for different versions. Also there could be that they did add a easier way to get the correct value. I did not yet update myself about the changes in the streams in Redis 6.

@Jean-Beru
Copy link
Contributor Author

Thanks @alexander-schranz ! I updated my code.

But, I am wondering if we have to limit xRange results to 1000 (for example) in order to limit memory usage and use the last element to get the next "page" (like using a SCAN).

@alexander-schranz
Copy link
Contributor

I did have a look at the latest changes about redis. The new version Redis 7 provides entries_read and lag.

redis/redis#9127
https://redis.io/commands/xinfo-groups/

Not 100% sure but could be that lag provide the information we need.

@Jean-Beru
Copy link
Contributor Author

I ran tests on a Redis 7.x a lag seems to do the job !

@Jean-Beru Jean-Beru force-pushed the messenger/redis-message-count-aware branch 2 times, most recently from a403e97 to ffd2b07 Compare May 23, 2022 19:34
@fabpot fabpot force-pushed the messenger/redis-message-count-aware branch from ffd2b07 to e1a896f Compare July 20, 2022 16:34
@fabpot
Copy link
Member

fabpot commented Jul 20, 2022

Thank you @Jean-Beru.

@fabpot fabpot merged commit 2949e9c into symfony:6.2 Jul 20, 2022
@alexander-schranz
Copy link
Contributor

Good work @Jean-Beru 👍

@Jean-Beru Jean-Beru deleted the messenger/redis-message-count-aware branch July 20, 2022 17:30
@Jean-Beru
Copy link
Contributor Author

Thanks a lot for your help @alexander-schranz !

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.