-
Notifications
You must be signed in to change notification settings - Fork 186
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
ChannelInvalidStateError after updating secret and publishing a message #618
Comments
You should know that every error that is occurring in an AMQP connection will force the connection to be closed. Thus it is normal, that the robust connection will try to establish another connection again after the current one has been closed due to this error. We are using the OAuth2 backend as well, but have slightly different approach. Since the access token normally includes information about its own expiration one can easily calculate the absolute expiry in time themselves and check for this condition to renew the token BEFORE any subsequent operation is executed in the AMQP connection. Thus you can always be sure that you have a fresh token before triggering an AMQP operation. |
Hi, I'm using the RabbitMQ OAuth 2.0 authentication backend, and therefore connecting to the broker with access tokens. These tokens can expire, so I have a wrapper around the publishing function that looks somewhat like this:
The issue is that when calling
func
after updating the secret, aChannelInvalidStateError
is raised, since the channel was closed. Addingawait asyncio.sleep(0.01)
before trying to callfunc
again fixes the issue, but seems a bit hacky. Is there some mechanism for waiting until the channel is open again?The text was updated successfully, but these errors were encountered: