diff options
-rw-r--r-- | bookpipeline/aws.go | 3 | ||||
-rw-r--r-- | bookpipeline/cmd/bookpipeline/main.go | 1 |
2 files changed, 4 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{ diff --git a/bookpipeline/cmd/bookpipeline/main.go b/bookpipeline/cmd/bookpipeline/main.go index 610b969..f1309ca 100644 --- a/bookpipeline/cmd/bookpipeline/main.go +++ b/bookpipeline/cmd/bookpipeline/main.go @@ -242,6 +242,7 @@ func heartbeat(conn Pipeliner, t *time.Ticker, msg bookpipeline.Qmsg, queue stri return } if m.Id != "" { + conn.GetLogger().Println("Replaced message handle as visibilitytimeout limit was reached") currentmsg = m // TODO: maybe handle communicating new msg more gracefully than this for range msgc { |