MCPcopy
hub / github.com/passteque/gluetun / logAndWait

Method logAndWait

internal/shadowsocks/loop.go:26–40  ·  view source on GitHub ↗
(ctx context.Context, err error)

Source from the content-addressed store, hash-verified

24}
25
26func (l *Loop) logAndWait(ctx context.Context, err error) {
27 if err != nil {
28 l.logger.Error(err.Error())
29 }
30 l.logger.Info("retrying in " + l.backoffTime.String())
31 timer := time.NewTimer(l.backoffTime)
32 l.backoffTime *= 2
33 select {
34 case <-timer.C:
35 case <-ctx.Done():
36 if !timer.Stop() {
37 <-timer.C
38 }
39 }
40}
41
42const defaultBackoffTime = 10 * time.Second
43

Callers 1

RunMethod · 0.95

Calls 4

ErrorMethod · 0.65
InfoMethod · 0.65
StringMethod · 0.65
StopMethod · 0.65

Tested by

no test coverage detected