Skip to content

Commit

Permalink
[FIXED] Invalid PullExpiry validation (#1468)
Browse files Browse the repository at this point in the history
Signed-off-by: Piotr Piotrowski <piotr@synadia.com>
  • Loading branch information
piotrpio authored Nov 11, 2023
1 parent f214371 commit e41d5ce
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions jetstream/options.go
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@ type PullExpiry time.Duration

func (exp PullExpiry) configureConsume(opts *consumeOpts) error {
expiry := time.Duration(exp)
if expiry < 1*time.Second {
if expiry < time.Second {
return fmt.Errorf("%w: expires value must be at least 1s", ErrInvalidOption)
}
opts.Expires = expiry
Expand All @@ -131,7 +131,7 @@ func (exp PullExpiry) configureConsume(opts *consumeOpts) error {

func (exp PullExpiry) configureMessages(opts *consumeOpts) error {
expiry := time.Duration(exp)
if expiry < 0 {
if expiry < time.Second {
return fmt.Errorf("%w: expires value must be at least 1s", ErrInvalidOption)
}
opts.Expires = expiry
Expand Down

0 comments on commit e41d5ce

Please sign in to comment.