Skip to content

Commit

Permalink
disable back off while testing
Browse files Browse the repository at this point in the history
  • Loading branch information
fujiwara committed Apr 5, 2024
1 parent 9a85f8c commit 19897bb
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 1 deletion.
2 changes: 2 additions & 0 deletions const.go
Original file line number Diff line number Diff line change
Expand Up @@ -78,3 +78,5 @@ var (
OutputHookStdout bool
OutputHookStderr bool
)

var RetryBackoff = true
5 changes: 4 additions & 1 deletion supervisor.go
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,10 @@ func StartSupervisor(conf *config.Config) (Supervisor, error) {
for cnt := 0; cnt < RetryOnceCount; cnt++ {
select {
case req := <-s.retryq:
delay := time.Duration(math.Pow(float64(req.Tries), 2)) * 100 * time.Millisecond
var delay time.Duration
if RetryBackoff {
delay = time.Duration(math.Pow(float64(req.Tries), 2)) * 100 * time.Millisecond
}
time.AfterFunc(delay, func() {
reqs := &[]Request{req}
select {
Expand Down
1 change: 1 addition & 0 deletions supervisor_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@ func (tr TestResponseHandler) HookCmd() string {
func init() {
logrus.SetLevel(logrus.WarnLevel)
conf.Apns.Host = gunfish.MockServer
gunfish.RetryBackoff = false // for testing
}

func TestEnqueuRequestToSupervisor(t *testing.T) {
Expand Down

0 comments on commit 19897bb

Please sign in to comment.