Skip to content
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

Connection.drain_events() time out wont apply unless i got message after the time out #1871

Open
ghost opened this issue Jan 11, 2024 · 0 comments

Comments

@ghost
Copy link

ghost commented Jan 11, 2024

using kombu 5.2.4 and amqp==5.1.1

hey morning i got issue with Connection.drain_events(timeout=60) function
it stay in drain event a lot more than it should by the given timeout
i built an example code that give the same problem and in the mean time i built another process that send garbage message every 60 seconds so the drain_event would stop after 60 seconds.
i do not think that is optimal solution and would be glad to have alternative solution as in my understanding drain event should throw time out error after 60 seconds even if message wasn't given

example code:

    with Connection(self.broker_url, ssl=self.ssl, heartbeat=self.heartbeat) as conn:
        chan = conn.channel()
        with conn.Consumer(channel=chan, callbacks=[messageHandler]) as self.consumer:
            chan.basic_qos(prefetch_size=0, prefetch_count=self.prefetch_count, a_global=False)
            entry_time = time.time()
            self.logger.info('performing drain_events with drain_events_time_out=60')
            conn.drain_events(timeout=60)
            exit_time = time.time()
            time_in_drain_events = exit_time - entry_time
            self.logger.info('drain_events exited after time_in_drain_events=%s', time_in_drain_events)

got log like:
drain_events exited after time_in_drain_events=225.69921612739563
which is way more than the excepted 60s
checked my messages log and found that the connection doesn't respect the timeout if the connection do not got message

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

0 participants