(ctx context.Context)
| 21 | } |
| 22 | |
| 23 | func (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 | |
| 47 | func TestStress(t *testing.T) { |
| 48 | t.Parallel() |