-
-
Notifications
You must be signed in to change notification settings - Fork 595
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
Fixed the problem of AsyncAioPikaManager repeatedly creating a connec… #692
Conversation
This is my first time to contribute code😄. give me some advice. |
return queue | ||
def initialize(self): | ||
loop = asyncio.get_event_loop() | ||
loop.create_task(self._initialize()) |
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.
This is a really strange way to initialize. It is also bound to race conditions, since you also call _initialize() in the _listen() method. I mean, I understand why you are doing it, but it isn't a robust solution, I think.
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.
What do you suggest? I want to do this well.
channel = await self._channel(connection) | ||
exchange = await self._exchange(channel) | ||
await exchange.publish( | ||
await self.listener_exchange.publish( |
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.
This will fail if the connection to the queue breaks and needs to be re-established. The Redis manage, which is the one that the vast majority of people use, has connection retries, maybe we want that here as well?
self.listener_channel, exchange | ||
) | ||
retry_sleep = 1 | ||
await self._initialize() |
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.
This is problematic, because you have one more _initialize() call above. Both will set the same variables.
8e19980
to
82cc2cb
Compare
b069fc5
to
ed5679a
Compare
Given the lack of response and the fact that this PR is now outdated, I will close it. Please open a new PR and address my feedback if you want me to add this. |
No description provided.