@@ -11,8 +11,8 @@ use tower::{Service, ServiceExt};
11
11
use tracing as log;
12
12
use tracing:: Instrument ;
13
13
use triagebot:: { db, github, handlers:: Context , notification_listing, payload, EventName } ;
14
- // use std::{time::Duration, thread};
15
- // use tokio::task;
14
+ use std:: { time:: Duration , thread} ;
15
+ use tokio:: task;
16
16
17
17
async fn handle_agenda_request ( req : String ) -> anyhow:: Result < String > {
18
18
if req == "/agenda/lang/triage" {
@@ -237,21 +237,19 @@ async fn run_server(addr: SocketAddr) -> anyhow::Result<()> {
237
237
let pool = db:: ClientPool :: new ( ) ;
238
238
db:: run_migrations ( & * pool. get ( ) . await )
239
239
. await
240
- . context ( "database migrations" ) ?;
240
+ . context ( "database migrations" ) ?;
241
241
242
- db:: run_scheduled_events ( & * pool. get ( ) . await )
243
- . await
244
- . context ( "database scheduled_events" ) ?;
242
+ task:: spawn ( async move {
243
+ let pool = db:: ClientPool :: new ( ) ;
245
244
246
- // task::spawn(async move {
247
- // loop {
248
- // thread::sleep(Duration::from_secs(60)); // every one minute
245
+ loop {
246
+ thread:: sleep ( Duration :: from_secs ( 60 ) ) ; // every one minute
249
247
250
- // db::run_scheduled_events(&*pool.get().await)
251
- // .await
252
- // .context("database scheduled_events")? ;
253
- // }
254
- // });
248
+ db:: run_scheduled_events ( & * pool. get ( ) . await )
249
+ . await
250
+ . context ( "database scheduled_events" ) . unwrap ( ) ;
251
+ }
252
+ } ) ;
255
253
256
254
let client = Client :: new ( ) ;
257
255
let gh = github:: GithubClient :: new_with_default_token ( client. clone ( ) ) ;
0 commit comments