From cee9c2228ef9299facaf1498fee9722c0fae237e Mon Sep 17 00:00:00 2001 From: mkhusid Date: Sun, 27 Dec 2020 16:51:17 +0200 Subject: [PATCH] add some debugging to leaser --- google/cloud/pubsub_v1/subscriber/_protocol/leaser.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/google/cloud/pubsub_v1/subscriber/_protocol/leaser.py b/google/cloud/pubsub_v1/subscriber/_protocol/leaser.py index 5830680da..03c04f670 100644 --- a/google/cloud/pubsub_v1/subscriber/_protocol/leaser.py +++ b/google/cloud/pubsub_v1/subscriber/_protocol/leaser.py @@ -142,6 +142,11 @@ def maintain_leases(self): # that in the event of a badly behaving actor, we can drop messages # and allow the Pub/Sub server to resend them. cutoff = time.time() - self._manager.flow_control.max_lease_duration + + # Add some debugging + for ack_id, item in six.iteritems(leased_messages): + print(f"[Lease manager] ack_id = {ack_id[0:2]}..{ack_id[len(ack_id)-4:len(ack_id)]}; seconds to drop = {round(item.sent_time - cutoff)} ") + to_drop = [ requests.DropRequest(ack_id, item.size, item.ordering_key) for ack_id, item in six.iteritems(leased_messages)