Skip to content

Commit

Permalink
Add retry=3 to AMS methods for reliability
Browse files Browse the repository at this point in the history
  • Loading branch information
tofu-rocketry committed Dec 1, 2020
1 parent 936d405 commit 9641a8e
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions ssm/ssm2.py
Original file line number Diff line number Diff line change
Expand Up @@ -388,7 +388,7 @@ def _send_msg_ams(self, text, msgid):
message = AmsMessage(data=to_send,
attributes={'empaid': msgid}).dict()

argo_response = self._ams.publish(self._dest, message)
argo_response = self._ams.publish(self._dest, message, retry=3)
return argo_response['messageIds'][0]

def pull_msg_ams(self):
Expand All @@ -408,7 +408,8 @@ def pull_msg_ams(self):
ackids = []

for msg_ack_id, msg in self._ams.pull_sub(self._listen,
messages_to_pull):
messages_to_pull,
retry=3):
# Get the AMS message id
msgid = msg.get_msgid()
# Get the SSM dirq id
Expand Down Expand Up @@ -437,7 +438,7 @@ def pull_msg_ams(self):
# it can move the offset for the next subscription pull
# (basically acknowledging pulled messages)
if ackids:
self._ams.ack_sub(self._listen, ackids)
self._ams.ack_sub(self._listen, ackids, retry=3)

def send_ping(self):
"""Perform connection stay-alive steps.
Expand Down

0 comments on commit 9641a8e

Please sign in to comment.