mirror of
https://github.com/SkyfallWasTaken/arcade-monitor.git
synced 2024-11-22 00:43:39 +00:00
Add cron trigger
This commit is contained in:
parent
a358ce3870
commit
2bacb34e84
1 changed files with 8 additions and 0 deletions
|
@ -21,6 +21,14 @@ pub async fn main(req: Request, env: Env, _ctx: worker::Context) -> Result<Respo
|
|||
.await
|
||||
}
|
||||
|
||||
#[event(scheduled)]
|
||||
pub async fn scheduled(_event: ScheduledEvent, env: Env, _ctx: ScheduleContext) {
|
||||
run_scrape(env).await.expect(&format!(
|
||||
"failed to run scheduled scrape: {}",
|
||||
_event.schedule()
|
||||
));
|
||||
}
|
||||
|
||||
async fn run_scrape(env: Env) -> Result<String> {
|
||||
let shop_url = Url::parse(&env.var("ARCADE_SHOP_URL")?.to_string())?;
|
||||
let webhook_url = env.var("SLACK_WEBHOOK_URL")?.to_string();
|
||||
|
|
Loading…
Reference in a new issue