Skip to content

Commit

Permalink
Add time.Sleep(500ms) in retry loop (fixes #2).
Browse files Browse the repository at this point in the history
  • Loading branch information
71 committed Nov 22, 2020
1 parent 9c885f7 commit e1ad48c
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
2 changes: 2 additions & 0 deletions cmd/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import (
"fmt"
"log"
"os/exec"
"time"

"github.com/71/stadiacontroller"
)
Expand Down Expand Up @@ -63,6 +64,7 @@ func run() error {

if err != nil {
if errors.Is(err, stadiacontroller.RetryError) {
time.Sleep(500 * time.Millisecond)
continue
}
return err
Expand Down
4 changes: 2 additions & 2 deletions stadia.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,8 @@ type StadiaController struct {
}

func NewStadiaController() *StadiaController {
ticker := time.NewTicker(5000 * time.Millisecond)
controller := &StadiaController{nil, ticker, nil}
ticker := time.NewTicker(500 * time.Millisecond)
controller := &StadiaController{nil, ticker, RetryError}

go func() {
for range ticker.C {
Expand Down

0 comments on commit e1ad48c

Please sign in to comment.