MCPcopy Create free account
hub / github.com/CrunchyData/postgres-operator / Start

Method Start

internal/controller/runtime/ticker.go:42–72  ·  view source on GitHub ↗

Start is called by controller-runtime Controller and returns quickly. It cleans up when ctx is cancelled.

(
	ctx context.Context, q workqueue.TypedRateLimitingInterface[reconcile.Request],
)

Source from the content-addressed store, hash-verified

40// Start is called by controller-runtime Controller and returns quickly.
41// It cleans up when ctx is cancelled.
42func (t ticker) Start(
43 ctx context.Context, q workqueue.TypedRateLimitingInterface[reconcile.Request],
44) error {
45 ticker := time.NewTicker(t.Duration)
46
47 // Pass t.GenericEvent to h when it is not filtered out by p.
48 // - https://pkg.go.dev/sigs.k8s.io/controller-runtime/pkg/source/internal#EventHandler
49 emit := func() {
50 t.Handler.Generic(ctx, t.GenericEvent, q)
51 }
52
53 if t.Immediate {
54 emit()
55 }
56
57 // Repeat until ctx is cancelled.
58 go func() {
59 defer ticker.Stop()
60
61 for {
62 select {
63 case <-ticker.C:
64 emit()
65 case <-ctx.Done():
66 return
67 }
68 }
69 }()
70
71 return nil
72}

Callers 10

setupManagerFunction · 0.45
TestTickerFunction · 0.45
kubernetes3Function · 0.45
TestDefaultTracerFunction · 0.45
TestNewFunction · 0.45
TestCheckFunction · 0.45
TestEscapeFunction · 0.45
StartFunction · 0.45
mainFunction · 0.45

Calls

no outgoing calls

Tested by 7

setupManagerFunction · 0.36
TestTickerFunction · 0.36
TestDefaultTracerFunction · 0.36
TestNewFunction · 0.36
TestCheckFunction · 0.36
TestEscapeFunction · 0.36