Skip to content

Commit

Permalink
Add reset visibility param to aws_sqs input to potentially avoid rese…
Browse files Browse the repository at this point in the history
…tting visibility timeout
  • Loading branch information
ekeric13 committed Oct 20, 2021
1 parent 0150fae commit 9aedddd
Showing 1 changed file with 11 additions and 6 deletions.
17 changes: 11 additions & 6 deletions lib/input/aws_sqs.go
Original file line number Diff line number Diff line change
Expand Up @@ -71,17 +71,19 @@ You can access these metadata fields using

// AWSSQSConfig contains configuration values for the input type.
type AWSSQSConfig struct {
sess.Config `json:",inline" yaml:",inline"`
URL string `json:"url" yaml:"url"`
DeleteMessage bool `json:"delete_message" yaml:"delete_message"`
sess.Config `json:",inline" yaml:",inline"`
URL string `json:"url" yaml:"url"`
DeleteMessage bool `json:"delete_message" yaml:"delete_message"`
ResetVisibility bool `json:"reset_visibility" yaml:"reset_visibility"`
}

// NewAWSSQSConfig creates a new Config with default values.
func NewAWSSQSConfig() AWSSQSConfig {
return AWSSQSConfig{
Config: sess.NewConfig(),
URL: "",
DeleteMessage: true,
Config: sess.NewConfig(),
URL: "",
DeleteMessage: true,
ResetVisibility: true,
}
}

Expand Down Expand Up @@ -405,6 +407,9 @@ func (a *awsSQS) ReadWithContext(ctx context.Context) (types.Message, reader.Asy
return nil
}

if !a.conf.ResetVisibility {
return nil
}
select {
case <-rctx.Done():
return rctx.Err()
Expand Down

0 comments on commit 9aedddd

Please sign in to comment.