-
-
Notifications
You must be signed in to change notification settings - Fork 90
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add Routine support #235
Comments
this change is not super nice design but it is necessary for now, since routines and listeners need access to systems such as `TagSystem`, `ModAuditLogStore` and similar, which are created there. the plan is to make all of this nicer with Together-Java#235 and Together-Java#236
This issue is stale because it has been open 30 days with no activity. Remove stale label or comment or this will be closed in 5 days. |
This is actually still relevant, we need it eventually. |
This issue is stale because it has been open 30 days with no activity. Remove stale label or comment or this will be closed in 5 days. |
I feel like this has to be split into two separate topics:
|
Regarding the second part, we decided that there is no pleasant way to offer a generic scheduler solution for persisted-one-shot-tasks. The problem is that its pretty much impossible to persist a generic @FunctionalInterface
public interface Task extends Serializable {
void run(JDA jda);
} (with Java serialization or JSON or similar) We concluded that users interested in a persisted-scheduled-one-shot-task features need to roll a custom domain-specific solution each. However, we agreed that a big part of that can still be taken by a generic helper solution that assists users in creating such a custom system. It could for example register listeners by name and then persist simple content, such as the name of the interested listeners, together with the schedule. That way, it could do all the heavy lifting of the task scheduling but instead of triggering persisted tasks, it merely triggeres persisted listeners, who know better how to do the actual task at hand. Before we create such a system however, we first want to wait for one or two users to create custom solutions. It is much easier to identify and extract the duplicated logic and put them into a helper system in hindsight. |
Agreed, Runnables should NOT be persisted in the database however there is no problem with using the database to persist the routines u dont need special serializable functionality or some stuff public interface RoutineBooter {
Collection<Routines> loadRoutines(BD db);
} if u do this the routines can still be stored in the db (for example a table containing a list of channels can be stored in the database and converted into a Routine that monitors those channels) (or a table of users can be converted into a routine that mutes those users on rejoin) tl:dr storing runnables in the database is DEFINTELY a bad idea, however there is absolutely nothing wrong with storing the data thats needed to generate runnables in a custom manner |
Yeah. I didnt saw a need to persist routines ("execute me every 5 minutes") yet though. Their schedule can just be restarted upon bot launch. "Bot launches; Hey routine, whats ur schedule again? Okay will execute u each 5 mins." The persistence bit is only interesting for one-shot tasks like |
More and more commands need to execute code on a scheduled routine (for example every x minutes or once per day or once at a specific date).
The command system should offer a generic way to all commands (also, not just SlashCommands) to schedule their actions on a central managed scheduler.
The interface should be easy and convenient to use for all registered commands. It should at least offer ways to:
execute code at date/time (send birthday greetings to zabu at 8th november)execute code after a specific waiting time (expire this message in 2 days)optionally persist a schedule, so that it is not lost if the bot is shutdown (/remind me at ... command)The exact needs are not yet known but commands wanting to use such mechanisms are slowly comming (mod audit log, top helper, free command, ...)
Edit: Removed any sort of persisted-one-shot-tasks from the scope of this issue (see comments for why).
The text was updated successfully, but these errors were encountered: