Introduce a Configuration to Manage and Disable Commands or Controllers #100

Open
opened 2020-06-05 03:09:31 +01:00 by Ghost · 0 comments
Ghost commented 2020-06-05 03:09:31 +01:00 (Migrated from codeberg.org)

Feature Request

Description

In the early versions of Commandler, we included a TestRunner which could test all controllers through a Controller#test() method. This has been removed as this defeats the purpose of lazy controller initialization. It's also somewhat wasteful to call test methods for many controllers depending on what they're doing to test if they're working as intended.

We will be superseding this with an alternative system where commands can let Commandler know that something has gone wrong with a command, and a configuration in Commandler which can disable commands or controllers if they hit an error threshold.

Uncaught exceptions should count as a failure by default, otherwise we can provide users with a way to manually report a failure.

The configuration should include:

  • if the feature is enabled at all (default: false)
  • if it should track per command, or per controller (default: command?)
  • the number of consecutive failures that should warrant disabling it (default: 10?)
  • the number of seconds the module should be disabled for (default: 60?)

Motivation

Occasionally APIs can be down or have problems, or at some point a command doesn't work as it was meant to. During these times it's better to shut the command/controller down temporarily rather than let the controller go ham with exceptions, or spamming an API that's already down.

# Feature Request <!-- If you feel a heading is irrelevant, just leave it empty or remove it. --> ## Description <!-- Explain what this is about, try to use full sentences, and make your point clear. --> In the early versions of Commandler, we included a `TestRunner` which could test all controllers through a `Controller#test()` method. This has been removed as this defeats the purpose of lazy controller initialization. It's also somewhat wasteful to call test methods for many controllers depending on what they're doing to test if they're working as intended. We will be superseding this with an alternative system where commands can let Commandler know that something has gone wrong with a command, and a configuration in Commandler which can disable commands or controllers if they hit an error threshold. Uncaught exceptions should count as a failure by default, otherwise we can provide users with a way to manually report a failure. The configuration should include: * if the feature is enabled at all (default: false) * if it should track per command, or per controller (default: command?) * the number of consecutive failures that should warrant disabling it (default: 10?) * the number of seconds the module should be disabled for (default: 60?) ## Motivation <!-- Why is this a feature that should be implemented in Commandler rather than in your own project using it? What makes this fundamental, or reusable, or of demand to other developers? --> Occasionally APIs can be down or have problems, or at some point a command doesn't work as it was meant to. During these times it's better to shut the command/controller down temporarily rather than let the controller go ham with exceptions, or spamming an API that's already down.
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
SethFalco/commandler#100
No description provided.