canonical-ubuntu-qa team mailing list archive
-
canonical-ubuntu-qa team
-
Mailing list archive
-
Message #01996
[Merge] ~andersson123/autopkgtest-cloud:cache-amqp-smoothing into autopkgtest-cloud:master
Tim Andersson has proposed merging ~andersson123/autopkgtest-cloud:cache-amqp-smoothing into autopkgtest-cloud:master.
Requested reviews:
Canonical's Ubuntu QA (canonical-ubuntu-qa)
For more details, see:
https://code.launchpad.net/~andersson123/autopkgtest-cloud/+git/autopkgtest-cloud/+merge/456378
--
Your team Canonical's Ubuntu QA is requested to review the proposed merge of ~andersson123/autopkgtest-cloud:cache-amqp-smoothing into autopkgtest-cloud:master.
diff --git a/charms/focal/autopkgtest-web/webcontrol/cache-amqp b/charms/focal/autopkgtest-web/webcontrol/cache-amqp
index 512b495..c3688b0 100755
--- a/charms/focal/autopkgtest-web/webcontrol/cache-amqp
+++ b/charms/focal/autopkgtest-web/webcontrol/cache-amqp
@@ -172,16 +172,20 @@ class AutopkgtestQueueContents:
release,
arch,
)
- try:
- requests = self.get_queue_requests(queue_name)
- except AMQPChannelException as e:
- (code, _, _, _) = e.args
- if code != 404:
- raise
- requests = []
- # 404s invalidate the channel for some reason
- self.amqp_channel = self.amqp_con.channel()
- queue_size = len(requests)
+ tries = 3
+ tot = 0
+ for _ in range(tries):
+ try:
+ requests = self.get_queue_requests(queue_name)
+ tot += len(requests)
+ except AMQPChannelException as e:
+ (code, _, _, _) = e.args
+ if code != 404:
+ raise
+ requests = []
+ # 404s invalidate the channel for some reason
+ self.amqp_channel = self.amqp_con.channel()
+ queue_size = int(tot / tries)
logging.info(
"Queue %s has %d items", queue_name, queue_size
)
References