switch modules to accept an InputHandler instead of the full router

This commit is contained in:
Joel Wetzell
2026-05-20 21:03:41 -05:00
parent be0b1c4a5f
commit 4cedd58a76
31 changed files with 301 additions and 297 deletions
+2 -2
View File
@@ -70,7 +70,7 @@ func (r *Router) startModule(ctx context.Context, moduleId string) error {
return errors.New("module id not found")
}
r.moduleWait.Go(func() {
err := moduleInstance.Start(ctx, r)
err := moduleInstance.Start(ctx, r.HandleInput)
if err != nil {
// TODO(jwetzell): propagate module run errors better
r.logger.Error("error encountered running module", "moduleId", moduleId, "error", err)
@@ -211,7 +211,7 @@ func (r *Router) HandleInput(ctx context.Context, sourceId string, payload any)
Payload: payload,
Source: sourceId,
Modules: r.ModuleInstances,
Router: r,
InputHandler: r.HandleInput,
End: false,
})
if err != nil {