optimize: improve breaker algorithm on recovery time (#4077)

This commit is contained in:
Kevin Wan
2024-04-18 22:33:25 +08:00
committed by GitHub
parent 95b32b5779
commit 1540bdc4c9
10 changed files with 311 additions and 121 deletions

View File

@@ -302,10 +302,10 @@ func TestQueryRowsScanTimeout(t *testing.T) {
Foo string
}
conn := NewSqlConnFromDB(db)
ctx, cancel := context.WithTimeout(context.Background(), time.Millisecond)
defer cancel()
ctx, cancel := context.WithTimeout(context.Background(), time.Millisecond*2)
err := conn.QueryRowsCtx(ctx, &val, "any")
assert.ErrorIs(t, err, context.DeadlineExceeded)
cancel()
})
}