WithStallWait sets the max wait when the producer becomes stall producing messages. If a publish call is blocked for this long, ErrTooManyStalledMsgs is returned.
(ttl time.Duration)
| 700 | // messages. If a publish call is blocked for this long, ErrTooManyStalledMsgs |
| 701 | // is returned. |
| 702 | func WithStallWait(ttl time.Duration) PublishOpt { |
| 703 | return func(opts *pubOpts) error { |
| 704 | if ttl <= 0 { |
| 705 | return fmt.Errorf("%w: stall wait should be more than 0", ErrInvalidOption) |
| 706 | } |
| 707 | opts.stallWait = ttl |
| 708 | return nil |
| 709 | } |
| 710 | } |
| 711 | |
| 712 | // Predefined schedule constants for use with [WithScheduleCron]. |
| 713 | const ( |