-
Notifications
You must be signed in to change notification settings - Fork 17
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
Enable support for unicast messages #417
Conversation
Drop `aioredis` package as the project has been archived and it is now a part of `redis` package. Add `redis` to `requirementes.txt` file. To maintain compatibilities between packages, update `fakeredis` version in `requirements-tests.txt`. Signed-off-by: Jeny Sadadia <[email protected]>
cbec7e8
to
2c7cc10
Compare
8476747
to
f5187f1
Compare
I have been investigating unit test failure in
First,
When
This seems some kind of mock leak. |
It fixed the issue when I reset
|
The issue I am facing is somewhat similar to what explained here: https://stackoverflow.com/questions/75112530/pytest-monkeypatch-mock-leak |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM - The only issue is what we discussed in a meeting last week, there needs to be a way to close the queue or we'll have resource leaks in Redis. That's why I suggested to have the open / close endpoints (and kci
commands). I'll create a GitHub issue for it.
Add methods to `PubSub` class to push messages to Redis List, pop message from the list, and push `CloudEvent` to the list. Signed-off-by: Jeny Sadadia <[email protected]>
In order to enable support for unicast messages, introduce endpoints `/push` and `/pop` for pushing a message to a Redis list and popping a message from the list respectively. This is to serve load-balancing purpose by sending message to a single consumer. Signed-off-by: Jeny Sadadia <[email protected]>
Somehow after changing version of `fakeredis`, redis mock stays the same for all the unit tests even if `mock_pubsub` fixture has the default scope `function`. That's why value of `PubSub._redis.ID_KEY` becomes global among all the tests and `pubsub.subscribe` increments it based on the value from the previous test run. Fix the issue by resetting `ID_KEY` value to get subscription ID starting from 1 in `test_subscribe_multiple_channels`. Signed-off-by: Jeny Sadadia <[email protected]>
1a73daf
to
5c17c88
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
OK following the merge-and-fix approach to untangle the various pending PRs and conflicts with kernelci-core
related changes.
Use Redis list for enabling support for unicast messages for load-balancing use-case.
Introduced endpoints
/push
and/pop
for pushing messages to a Redis list and popping a message from thelist respectively.