diff --git a/_examples/real-world-examples/exactly-once-delivery-counter/run.go b/_examples/real-world-examples/exactly-once-delivery-counter/run.go index cb4ead13d..dc4aa1174 100644 --- a/_examples/real-world-examples/exactly-once-delivery-counter/run.go +++ b/_examples/real-world-examples/exactly-once-delivery-counter/run.go @@ -136,16 +136,20 @@ func restartMySQL() { } func sendCountRequest(counterUUID string) { - for { - resp, err := http.Post("http://localhost:8080/count/"+counterUUID, "", nil) - if err != nil { - continue - } - - if resp.StatusCode == http.StatusNoContent { - break - } - } + for { + resp, err := http.Post("http://localhost:8080/count/"+counterUUID, "", nil) + if err != nil { + time.Sleep(100 * time.Millisecond) + continue + } + resp.Body.Close() + + if resp.StatusCode == http.StatusNoContent { + break + } + + time.Sleep(100 * time.Millisecond) + } } func createDB() *stdSQL.DB {