Skip to content
Permalink
Browse files

Retry when failed to fetch status

  • Loading branch information...
takonomura committed Sep 8, 2019
1 parent ce3e085 commit 5f6a753377b60a9a935b3b0f9d7128c5057d087c
Showing with 8 additions and 0 deletions.
  1. +8 −0 isucari/webapp/go/main.go
@@ -14,6 +14,7 @@ import (
"os/exec"
"path/filepath"
"strconv"
"strings"
"sync"
"sync/atomic"
"time"
@@ -1038,6 +1039,13 @@ func getTransactions(w http.ResponseWriter, r *http.Request) {
ssr, err := APIShipmentStatus(r.Context(), getShipmentServiceURL(r.Context()), &APIShipmentStatusReq{
ReserveID: t.ReserveID,
})
if err != nil && strings.HasPrefix(err.Error(), "status code: 400; body: <html>") {
log.Printf("Retrying (concurrency: %d)", len(transactionEvidences))
time.Sleep(10 * time.Millisecond)
ssr, err = APIShipmentStatus(r.Context(), getShipmentServiceURL(r.Context()), &APIShipmentStatusReq{
ReserveID: t.ReserveID,
})
}
if err != nil {
concurrentError.Store(err)
return

0 comments on commit 5f6a753

Please sign in to comment.
You can’t perform that action at this time.