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

Method try_retry_load_guild_scripts

components/scheduler/src/guild_handler.rs:509–533  ·  view source on GitHub ↗
(&mut self)

Source from the content-addressed store, hash-verified

507 }
508
509 async fn try_retry_load_guild_scripts(&mut self) {
510 loop {
511 let scripts = match self.stores.list_scripts(self.guild_id).await {
512 Ok(scripts) => scripts,
513 Err(err) => {
514 error!(%err, "failed loading guild scripts, retrying in 10 secs");
515 tokio::time::sleep(Duration::from_secs(10)).await;
516 continue;
517 }
518 };
519
520 let freshness = match self.stores.get_script_derived_freshness(self.guild_id).await {
521 Ok(freshness) => freshness,
522 Err(err) => {
523 error!(%err, "failed loading derived script state, retrying in 10 secs");
524 tokio::time::sleep(Duration::from_secs(10)).await;
525 continue;
526 }
527 };
528
529 self.scripts = scripts.into_iter().filter(|v| v.enabled).collect();
530 self.derived_freshness = freshness.into_iter().map(|v| (v.script_id, v)).collect();
531 return;
532 }
533 }
534
535 async fn dispatch_scheduled_task(&mut self, task: ScheduledTask) {
536 info!("dispatching scheduled task");

Callers 2

setupMethod · 0.80
reload_guild_scriptsMethod · 0.80

Calls 2

list_scriptsMethod · 0.80

Tested by

no test coverage detected