-
-
Notifications
You must be signed in to change notification settings - Fork 751
Scheduler Redesign #800
Copy link
Copy link
Closed
Labels
a: backendRelated to internal functionality and utilities (error_handler, logging, security, utils and core)Related to internal functionality and utilities (error_handler, logging, security, utils and core)p: 1 - highHigh PriorityHigh Prioritys: WIPWork In ProgressWork In Progresss: planningDiscussing detailsDiscussing detailst: featureNew feature or requestNew feature or request
Metadata
Metadata
Assignees
Labels
a: backendRelated to internal functionality and utilities (error_handler, logging, security, utils and core)Related to internal functionality and utilities (error_handler, logging, security, utils and core)p: 1 - highHigh PriorityHigh Prioritys: WIPWork In ProgressWork In Progresss: planningDiscussing detailsDiscussing detailst: featureNew feature or requestNew feature or request
Type
Fields
Give feedbackNo fields configured for issues without a type.
Note: this is written as if #755 has already been merged.
Current Problems
Description
The scheduler currently designed with inheritance. The task scheduled is an abstract method which subclasses have to implemented. This design is restrictive because it only supports that one coroutine for scheduling. Some features may require several different coroutines to be scheduled. While it's possible to defer to other functions inside the abstract method, it gets messy. A better design seems to be to allow specifying the exact coroutine one wishes to schedule.
The above change would remove reliance on an abstract method thus allowing for composition to be used instead of inheritance. This is useful when different code needs to share a scheduler. For example, the
ModManagementcog currently relies on theInfractionscog so it can re-schedule infractions if durations are edited. With composition, the scheduler could be created and passed to both cogs when they get instantiated insetup().Similar to specifying the coroutine to schedule, a callback for exception handling can also be specified. By default the exception will simply be logged. If a user-invoked command scheduled a task which raised an exception, the user won't know about it - the command may fail silently from the user's perspective. In such case, the aforementioned callback would enable a message to be sent to the user. As another example, it could be used to still send a mod log if an automatic expiration of an infraction raised an unhanded exception.
I'm labelling this as "planning" for now to get thoughts on the above. Do you believe these are indeed problems with the current designs? Do you think the proposed changes are good? What other problems can you identify with the scheduler?