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

Method Start

rivershared/startstoptest/startstoptest_test.go:23–45  ·  view source on GitHub ↗
(ctx context.Context)

Source from the content-addressed store, hash-verified

21}
22
23func (s *MyService) Start(ctx context.Context) error {
24 ctx, shouldStart, started, stopped := s.StartInit(ctx)
25 if !shouldStart {
26 return nil
27 }
28
29 if s.startErr != nil {
30 stopped()
31 return s.startErr
32 }
33
34 go func() {
35 started()
36 defer stopped()
37
38 s.logger.DebugContext(ctx, "Service started")
39 defer s.logger.DebugContext(ctx, "Service stopped")
40
41 <-ctx.Done()
42 }()
43
44 return nil
45}
46
47func TestStress(t *testing.T) {
48 t.Parallel()

Callers

nothing calls this directly

Calls 2

StartInitMethod · 0.80
DoneMethod · 0.80

Tested by

no test coverage detected