Skip to content

Commit

Permalink
Apply log on polling
Browse files Browse the repository at this point in the history
  • Loading branch information
onee-only committed Jul 16, 2024
1 parent cf9105c commit 35901d1
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions internal/job/poller.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ package job
import (
"context"
"encoding/json"
"log"

"github.com/aws/aws-sdk-go-v2/service/sqs"
"github.com/aws/aws-sdk-go/aws"
Expand Down Expand Up @@ -42,11 +43,15 @@ func (p *poller) Poll(ctx context.Context) (id string, job Job, err error) {

msg := result.Messages[0]

log.Println(*msg.Body)

var decoded Job
if err := json.Unmarshal([]byte(*msg.Body), &job); err != nil {
return "", Job{}, errors.Wrap(err, "failed to unmarshal job")
}

log.Println(decoded)

return *msg.ReceiptHandle, decoded, nil
}

Expand Down

0 comments on commit 35901d1

Please sign in to comment.