Skip to content

Commit 81ca933

Browse files
Updated context cancellation
1 parent 3a0d89e commit 81ca933

File tree

2 files changed

+5
-2
lines changed

2 files changed

+5
-2
lines changed

bin/laclm

30.1 MB
Binary file not shown.

cmd/laclm/main.go

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -130,6 +130,11 @@ func run(ctx context.Context) error {
130130
logCtx, logCancel := context.WithCancel(context.Background())
131131
var logWg sync.WaitGroup
132132

133+
defer func() {
134+
logCancel()
135+
logWg.Wait()
136+
}()
137+
133138
/* create a error channel */
134139
errChLog := make(chan error, 1)
135140

@@ -345,8 +350,6 @@ func run(ctx context.Context) error {
345350

346351
/* close the logging error channel and cancel logging context */
347352
close(errChLog)
348-
logCancel()
349-
logWg.Wait()
350353

351354
return err
352355
}

0 commit comments

Comments
 (0)