Add support for RunShutdownable to actorSet

This commit is contained in:
Sasha Koshka 2025-01-30 19:28:33 -05:00
parent b4c55decc6
commit 1133e261bf

View File

@ -16,6 +16,7 @@ type actorSets struct {
configurable actorSet[Configurable] configurable actorSet[Configurable]
initializable actorSet[Initializable] initializable actorSet[Initializable]
runnable actorSet[Runnable] runnable actorSet[Runnable]
runShutdownable actorSet[RunShutdownable]
trimmable actorSet[Trimmable] trimmable actorSet[Trimmable]
} }
@ -52,6 +53,7 @@ func (sets *actorSets) All() iter.Seq[actorSetIface] {
yield(&sets.configurable) yield(&sets.configurable)
yield(&sets.initializable) yield(&sets.initializable)
yield(&sets.runnable) yield(&sets.runnable)
yield(&sets.runShutdownable)
yield(&sets.trimmable) yield(&sets.trimmable)
} }
} }
@ -66,7 +68,9 @@ func (this *actorSets) add(ctx context.Context, actor Actor) {
done: done, done: done,
order: this.nextOrder, order: this.nextOrder,
} }
if _, ok := actor.(Runnable); ok { _, isRunnable := actor.(Runnable)
_, isRunShutdownable := actor.(RunShutdownable)
if isRunnable || isRunShutdownable {
info.stopped = make(chan struct { }) info.stopped = make(chan struct { })
} }
this.inf[actor] = info this.inf[actor] = info