My golang-application uses aws-sdk-go
to interact with an input queue. One message from the queue is processed about 7-10 min by a goroutine and then deleted. I would like to hide the message in the input queue setting VisibilityTimeout
to 10min because another goroutines should not process the same message in this time interval.
There are risks that I can get when app is shut down and its context is cancelled:
- If I do not reset
VisibilityTimeout
of a message somehow, I need to wait for it for 10min when app is restarted - If context is canceled (app is shutting down), I can't invoke
ChangeMessageVisibilityWithContext
to resetVisibilityTimeout
to0
when app is shut down, because cancelled context prevents this and the invocation will fail with error. I can create new context for this case but this is not good idea for some reasons
How do I reset VisibilityTimeout
for the input queue when app is restarted?