MCPcopy Index your code
hub / github.com/riverqueue/river / validate

Method validate

client.go:647–669  ·  view source on GitHub ↗
(queueName string, clientFetchCooldown time.Duration, clientFetchPollInterval time.Duration)

Source from the content-addressed store, hash-verified

645}
646
647func (c QueueConfig) validate(queueName string, clientFetchCooldown time.Duration, clientFetchPollInterval time.Duration) error {
648 if c.FetchCooldown < 0 {
649 return errors.New("FetchCooldown cannot be less than zero")
650 }
651 if c.FetchPollInterval < 0 {
652 return errors.New("FetchPollInterval cannot be less than zero")
653 }
654
655 resolvedFetchCooldown := cmp.Or(c.FetchCooldown, clientFetchCooldown)
656 resolvedFetchPollInterval := cmp.Or(c.FetchPollInterval, clientFetchPollInterval)
657 if resolvedFetchPollInterval < resolvedFetchCooldown {
658 return errors.New("FetchPollInterval cannot be less than FetchCooldown")
659 }
660
661 if c.MaxWorkers < 1 || c.MaxWorkers > QueueNumWorkersMax {
662 return fmt.Errorf("invalid number of workers for queue %q: %d", queueName, c.MaxWorkers)
663 }
664 if err := validateQueueName(queueName); err != nil {
665 return err
666 }
667
668 return nil
669}
670
671// Client is a single isolated instance of River. Your application may use
672// multiple instances operating on different databases or Postgres schemas

Callers

nothing calls this directly

Calls 2

validateQueueNameFunction · 0.85
ErrorfMethod · 0.65

Tested by

no test coverage detected