mirror of
https://github.com/pgsty/minio.git
synced 2026-10-31 12:52:27 +03:00
Preserve maintenance timeout behavior and prepare SILO 20261026
Signed-off-by: Feng Ruohang <rh@vonng.com>
This commit is contained in:
@@ -59,16 +59,6 @@ type Response struct {
|
||||
Err error
|
||||
}
|
||||
|
||||
type withoutDefaultTimeoutKey struct{}
|
||||
|
||||
// WithoutDefaultTimeout disables the implicit single-request timeout.
|
||||
// Explicit context cancellation and connection loss still end the request.
|
||||
// Use this for admitted mutations that must return their actual result before
|
||||
// the caller releases its lock.
|
||||
func WithoutDefaultTimeout(ctx context.Context) context.Context {
|
||||
return context.WithValue(ctx, withoutDefaultTimeoutKey{}, true)
|
||||
}
|
||||
|
||||
func newMuxClient(ctx context.Context, muxID uint64, parent *Connection) *muxClient {
|
||||
ctx, cancelFn := context.WithCancelCause(ctx)
|
||||
return &muxClient{
|
||||
@@ -111,10 +101,8 @@ func (m *muxClient) roundtrip(h HandlerID, req []byte) ([]byte, error) {
|
||||
m.respMu.Unlock()
|
||||
ctx := m.ctx
|
||||
|
||||
// Admitted storage mutations must not time out while the handler can
|
||||
// still commit. A zero wire deadline also keeps their late response.
|
||||
noDefaultTimeout, _ := ctx.Value(withoutDefaultTimeoutKey{}).(bool)
|
||||
if msg.DeadlineMS == 0 && !noDefaultTimeout {
|
||||
// Add deadline if none.
|
||||
if msg.DeadlineMS == 0 {
|
||||
msg.DeadlineMS = uint32(defaultSingleRequestTimeout / time.Millisecond)
|
||||
var cancel context.CancelFunc
|
||||
ctx, cancel = context.WithTimeout(ctx, defaultSingleRequestTimeout)
|
||||
|
||||
Reference in New Issue
Block a user