mirror of
https://github.com/seaweedfs/seaweedfs.git
synced 2026-10-21 22:12:36 +00:00
test: honor Retry-After in cold-start assign retry
Generated with [Devin](https://devin.ai) Co-Authored-By: Devin <158243242+devin-ai-integration[bot]@users.noreply.github.com>
This commit is contained in:
co-authored by
Devin <158243242+devin-ai-integration[bot]@users.noreply.github.com>
parent
4791d44d2c
commit
4fb5e5a154
@@ -8,6 +8,7 @@ import (
|
||||
"io"
|
||||
"mime/multipart"
|
||||
"net/http"
|
||||
"strconv"
|
||||
"testing"
|
||||
"time"
|
||||
|
||||
@@ -44,7 +45,11 @@ func TestColdStartFirstWrite(t *testing.T) {
|
||||
body, _ := io.ReadAll(resp.Body)
|
||||
resp.Body.Close()
|
||||
if resp.StatusCode == http.StatusServiceUnavailable && time.Now().Before(deadline) {
|
||||
time.Sleep(time.Second)
|
||||
delay, _ := strconv.Atoi(resp.Header.Get("Retry-After"))
|
||||
if delay <= 0 {
|
||||
t.Fatalf("dir/assign shed without a usable Retry-After: %d %s", resp.StatusCode, body)
|
||||
}
|
||||
time.Sleep(time.Duration(delay) * time.Second)
|
||||
continue
|
||||
}
|
||||
if resp.StatusCode != http.StatusOK {
|
||||
|
||||
Reference in New Issue
Block a user