MCPcopy Index your code
hub / github.com/riverqueue/river / Start

Method Start

rivershared/startstop/start_stop_test.go:28–50  ·  view source on GitHub ↗
(ctx context.Context)

Source from the content-addressed store, hash-verified

26}
27
28func (s *sampleService) Start(ctx context.Context) error {
29 ctx, shouldStart, started, stopped := s.StartInit(ctx)
30 if !shouldStart {
31 return nil
32 }
33
34 if s.startErr != nil {
35 stopped()
36 return s.startErr
37 }
38
39 go func() {
40 // Set this before confirming started.
41 s.state = true
42
43 started()
44 defer stopped()
45
46 <-ctx.Done()
47 }()
48
49 return nil
50}
51
52func testService(t *testing.T, newService func(t *testing.T) serviceWithStopped) {
53 t.Helper()

Callers 3

TestStoppedFunction · 0.95
TestStoppedUnsafeFunction · 0.95
TestStartedFunction · 0.95

Calls 2

StartInitMethod · 0.80
DoneMethod · 0.80

Tested by

no test coverage detected