rework module shutdown process to cancel module context in defer

This commit is contained in:
Joel Wetzell
2026-05-27 20:50:33 -05:00
parent 52ca801fbd
commit 0b494fce91
21 changed files with 197 additions and 216 deletions
+2 -3
View File
@@ -94,20 +94,19 @@ func (rc *RedisClient) Start(ctx context.Context, inputHandler common.InputHandl
rc.clientMu.Unlock()
<-rc.ctx.Done()
rc.logger.Debug("done")
return nil
}
func (rc *RedisClient) Stop() {
if rc.cancel != nil {
rc.cancel()
defer rc.cancel()
}
rc.clientMu.Lock()
defer rc.clientMu.Unlock()
if rc.client != nil {
rc.client.Close()
rc.client = nil
}
rc.logger.Debug("done")
}
func (rc *RedisClient) Get(ctx context.Context, key string) (any, error) {