Skip to content

Commit

Permalink
Merge pull request #50 from bitleak/fix/range-of-push-meta
Browse files Browse the repository at this point in the history
FIX: limit the range of the timeout and workers
  • Loading branch information
liguangbo committed Sep 2, 2020
2 parents 84d4501 + bfdb4bf commit 36adb63
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions push/meta.go
Original file line number Diff line number Diff line change
Expand Up @@ -267,11 +267,11 @@ func (mm *MetaManager) Dump() map[string]map[string][]string {
}

func (meta *Meta) Validate() error {
if meta.Workers <= 0 {
return errors.New("workers should be > 0")
if meta.Workers <= 0 || meta.Workers > 16 {
return errors.New("workers should be between 1 and 16")
}
if meta.Timeout <= 0 {
return errors.New("timeout should be > 0")
if meta.Timeout <= 0 || meta.Timeout > 3600 {
return errors.New("timeout should be between 1 and 3600")
}
_, err := url.ParseRequestURI(meta.Endpoint)
return err
Expand Down

0 comments on commit 36adb63

Please sign in to comment.