MCPcopy Create free account
hub / github.com/Botloader/botloader / handle_next_action

Method handle_next_action

components/scheduler/src/guild_handler.rs:179–211  ·  view source on GitHub ↗
(&mut self, action: NextGuildAction)

Source from the content-addressed store, hash-verified

177
178 #[instrument(skip(self), fields(guild_id = self.guild_id.get(), action = action.span_info()))]
179 pub(crate) async fn handle_next_action(&mut self, action: NextGuildAction) -> bool {
180 match action {
181 NextGuildAction::GuildCommand(GuildCommand::Shutdown) => {
182 info!("got shutdown signal");
183 return false;
184 }
185 NextGuildAction::GuildCommand(cmd) => {
186 self.handle_guild_command(cmd).await;
187 }
188 NextGuildAction::WorkerMessage(msg) => {
189 let Some(session) = &mut self.session else {
190 return true;
191 };
192
193 let events = session.handle_worker_msg(msg);
194 return self.handle_session_events(events).await;
195 }
196 NextGuildAction::CheckScheduledTasks => {
197 let tasks = self.scheduled_tasks_man.start_triggered_tasks().await;
198 for task in tasks {
199 self.dispatch_scheduled_task(task).await;
200 }
201 }
202 NextGuildAction::CheckIntervalTimers => {
203 let timers = self.interval_timers_man.trigger_timers().await;
204 for timer in timers {
205 self.dispatch_interval_timer(timer).await;
206 }
207 }
208 }
209
210 true
211 }
212
213 pub(crate) async fn next_event(&mut self) -> Option<NextGuildAction> {
214 self.scheduled_tasks_man.init_next_task_time().await;

Callers 1

runMethod · 0.80

Calls 7

handle_guild_commandMethod · 0.80
handle_worker_msgMethod · 0.80
handle_session_eventsMethod · 0.80
start_triggered_tasksMethod · 0.80
trigger_timersMethod · 0.80

Tested by

no test coverage detected