Should Agent#reset raise by default
Closed this issue · 4 comments
If reset on an Agent isn't explicitly overridden, it might be better to assume that the agent cannot be reset, instead of doing nothing.
I assumed that agents didn't need to reset something when they're recycled. This applies to most of the design: have noop methods that can be overridden if needed —except call
obviously.
But maybe I'm wrong.
It comes down to the question of if most agents are stateless, and as such don't need to be reset, or if most agents are stateful and a common source of errors is forgetting to override reset
.
I'd tend to believe the latter - and having to override reset
to do # nothing
isn't too much of a burden. Given how really every agent is designed to be in a supervision tree, it might even be best to make reset
abstract and force everyone to implement it. It seems a bit of a drastic measure but it's hard to tell.
So for now I'd guess this is fine as-is, until more real-world experience of how often forgetting to override #reset
happens in production.
Agents don't need to be supervised, so an abstract #reset
feels too drastic.
Looking at a real application using Earl I have, only 1 out of the 4 agent types needs to reset it's internal state —reconnect to an AMQP server because it's likely what crashed the agent. Others are stateless.
Flagged as wontfix for now. This needs more evidence from real applications.