Merge lp:~cprov/adt-result-checker/missing-ack-on-retry into lp:adt-result-checker

Proposed by Celso Providelo
Status: Merged
Approved by: Celso Providelo
Approved revision: 6
Merged at revision: 6
Proposed branch: lp:~cprov/adt-result-checker/missing-ack-on-retry
Merge into: lp:adt-result-checker
Diff against target: 41 lines (+5/-4)
2 files modified
.bzrignore (+1/-0)
adt_result_checker/__init__.py (+4/-4)
To merge this branch: bzr merge lp:~cprov/adt-result-checker/missing-ack-on-retry
Reviewer Review Type Date Requested Status
Paul Larson Approve
Para Siva (community) Approve
Thomi Richards Pending
Review via email: mp+253504@code.launchpad.net

Commit message

Adding missing message acknowledge when tests requests have to be retried.

Description of the change

Adding a missing message acknowledge when the test request had to be retried.

Code flow and readability in result-checker is not good and unfortunately it is the microservice more likely to change/evolve to provide better user experience (IMO).

I think it's related with the complete lack of unittests and Thomi has made his point here (biased ? extrapolated ? maybe ...), that we do need some extent of unittest in order to be comfortable enough with bug-fixing and small refactoring.

To post a comment you must log in.
Revision history for this message
Para Siva (psivaa) wrote :

LGTM

review: Approve
Revision history for this message
Paul Larson (pwlars) wrote :

should the message.ack() move to maybe_retry_message? It seems that there are some circumstances in maybe_retry_message where it could already get acked by way of insert_into_dead_letter_queue()

review: Needs Information
6. By Celso Providelo

Stop double-acking when the message goes to the dead-letter queue.

Revision history for this message
Paul Larson (pwlars) wrote :

+1

review: Approve
Revision history for this message
Celso Providelo (cprov) wrote :

I will work on basic unittests for a worker (kombu.ConsumerMixin) in a separated branch, we can use it.

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file '.bzrignore'
2--- .bzrignore 2015-03-16 02:06:27 +0000
3+++ .bzrignore 2015-03-19 13:09:13 +0000
4@@ -1,1 +1,2 @@
5 ve
6+adt_result_checker.egg-info
7
8=== modified file 'adt_result_checker/__init__.py'
9--- adt_result_checker/__init__.py 2015-03-18 01:58:38 +0000
10+++ adt_result_checker/__init__.py 2015-03-19 13:09:13 +0000
11@@ -73,18 +73,19 @@
12 message,
13 "Invalid result message format: {}".format(str(e))
14 )
15+ message.ack()
16 else:
17 if exit_code_implies_retry(exit_code):
18 self.maybe_retry_message(message)
19+ message.ack()
20 else:
21 if result_tarball_exists_in_swift(request_id):
22- if self.post_results(request_id):
23- message.ack()
24- else:
25+ if not self.post_results(request_id):
26 self.maybe_retry_message(
27 message,
28 "Unable to post results to swift"
29 )
30+ message.ack()
31 else:
32 # Swift does not yet contain the result tarball, so we
33 # can't process this yet: put it back in the queue for
34@@ -106,7 +107,6 @@
35 # own simple queue that no one ever automatically reads from. This is
36 # why we ack this message, even though we're really failing it.
37 message.payload['deadletter_reason'] = reason
38- message.ack()
39
40 queue = self.connection.SimpleQueue('adt.deadletters.{}'.format(API_VERSION))
41 queue.put(message.payload)

Subscribers

People subscribed via source and target branches