Welcome to mirror list, hosted at ThFree Co, Russian Federation.

suppressed_context.go « helper « internal - gitlab.com/gitlab-org/gitaly.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 3806b91d85283c499c1941c487644b32099cfb5e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
package helper

import (
	"context"
	"time"
)

// suppressedContext suppresses cancellation or expiration of the context.
type suppressedContext struct{ context.Context }

func (suppressedContext) Deadline() (deadline time.Time, ok bool) { return time.Time{}, false }

func (suppressedContext) Done() <-chan struct{} { return nil }

func (suppressedContext) Err() error { return nil }

// SuppressCancellation returns a context that suppresses cancellation or expiration of the parent context.
func SuppressCancellation(ctx context.Context) context.Context { return suppressedContext{ctx} }