Skip to content

Commit

Permalink
Add logs for PocketIC polling.
Browse files Browse the repository at this point in the history
  • Loading branch information
q-uint committed May 6, 2024
1 parent 5ea3236 commit 5b981a0
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions pocketic/do.go
Original file line number Diff line number Diff line change
Expand Up @@ -35,10 +35,12 @@ func (pic PocketIC) do(method, url string, input, output any) error {
if err := json.NewDecoder(resp.Body).Decode(&response); err != nil {
return err
}
pic.logger.Printf("[POCKETIC] Accepted: %s %s", response.StateLabel, response.OpID)
if method == http.MethodGet {
continue
}
for {
pic.logger.Printf("[POCKETIC] Waiting for %s %s", response.StateLabel, response.OpID)
if pic.timeout < time.Since(start) {
return fmt.Errorf("timeout exceeded")
}
Expand Down Expand Up @@ -81,6 +83,7 @@ func (pic PocketIC) do(method, url string, input, output any) error {
if err := json.NewDecoder(resp.Body).Decode(&response); err != nil {
return err
}
pic.logger.Printf("[POCKETIC] Conflict: %s %s", response.StateLabel, response.OpID)
time.Sleep(pic.delay) // Retry after a short delay.
continue
default:
Expand Down

0 comments on commit 5b981a0

Please sign in to comment.