examples/panic: Make the actor resettable

This commit is contained in:
Sasha Koshka 2025-11-23 13:41:05 -05:00
parent c0064323d8
commit f0611e53ce

View File

@ -18,7 +18,8 @@ func main() {
// actor is an incorrectly implemented actor that panics and errs randomly.
type actor struct { }
var _ camfish.Runnable = new(actor)
var _ camfish.Runnable = new(actor)
var _ camfish.Resettable = new(actor)
func (this *actor) Type() string { return "panic" }
func (this *actor) Run(ctx context.Context) error {
@ -33,3 +34,8 @@ func (this *actor) Run(ctx context.Context) error {
}
}
}
func (this *actor) Reset(ctx context.Context) error {
log.Println("(i) [panic] here is where we would reset the actor")
return ctx.Err()
}