diff options
author | Nick White <git@njw.name> | 2019-09-14 08:24:27 +0100 |
---|---|---|
committer | Nick White <git@njw.name> | 2019-09-14 08:24:27 +0100 |
commit | 7b79288b55077c5f378b5f5e45f2ac8fd3be76ee (patch) | |
tree | c3d86dc52b1a6ef23b307c91cd263a020bd499bf /bookpipeline/aws.go | |
parent | f0b9f708496bb5335102846b65c1880596ee2ad3 (diff) |
Ensure enough time has elapsed before looking for the message to reget in the case of heartbeat running out
Diffstat (limited to 'bookpipeline/aws.go')
-rw-r--r-- | bookpipeline/aws.go | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/bookpipeline/aws.go b/bookpipeline/aws.go index e7ecd07..d51e4ea 100644 --- a/bookpipeline/aws.go +++ b/bookpipeline/aws.go @@ -5,6 +5,7 @@ import ( "fmt" "log" "os" + "time" "github.com/aws/aws-sdk-go/aws" "github.com/aws/aws-sdk-go/aws/awserr" @@ -131,6 +132,8 @@ func (a *AwsConn) QueueHeartbeat(msg Qmsg, qurl string, duration int64) (Qmsg, e // Check if the visibility timeout has exceeded the maximum allowed, // and if so try to find the message again to get a new handle. if ok && aerr.Code() == "InvalidParameterValue" { + // Wait for existing visibilitytimeout to expire + time.Sleep(time.Duration(duration) * time.Second) // Try 3 times to find the message for range [3]bool{} { msgResult, err := a.sqssvc.ReceiveMessage(&sqs.ReceiveMessageInput{ |