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 -2
View File
@@ -86,6 +86,7 @@ func (mo *MIDIOutput) Start(ctx context.Context, inputHandler common.InputHandle
mo.sendFuncMu.Unlock()
<-mo.ctx.Done()
mo.logger.Debug("done")
return nil
}
@@ -107,8 +108,7 @@ func (mo *MIDIOutput) Output(ctx context.Context, payload any) error {
func (mo *MIDIOutput) Stop() {
if mo.cancel != nil {
mo.cancel()
defer mo.cancel()
}
midi.CloseDriver()
mo.logger.Debug("done")
}