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