fix: was calling the wrong ctx
This commit is contained in:
parent
3dd81a5c54
commit
a8bed0bacc
1 changed files with 3 additions and 3 deletions
|
@ -51,10 +51,10 @@ impl EventHandler for Handler {
|
||||||
|
|
||||||
{
|
{
|
||||||
// this is to update member roles every 5 min
|
// this is to update member roles every 5 min
|
||||||
let ctx1 = Arc::clone(&ctx);
|
let ctx_task = Arc::clone(&ctx);
|
||||||
tokio::spawn(async move {
|
tokio::spawn(async move {
|
||||||
let db_lock = {
|
let db_lock = {
|
||||||
let data_read = ctx1.data.read().await;
|
let data_read = ctx_task.data.read().await;
|
||||||
data_read.get::<DataBase>().expect("Expected Database in TypeMap.").clone()
|
data_read.get::<DataBase>().expect("Expected Database in TypeMap.").clone()
|
||||||
};
|
};
|
||||||
let db = db_lock.read().await;
|
let db = db_lock.read().await;
|
||||||
|
@ -62,7 +62,7 @@ impl EventHandler for Handler {
|
||||||
loop {
|
loop {
|
||||||
println!("User update - Start");
|
println!("User update - Start");
|
||||||
for server_config in get_server_config_bulk(&db).await {
|
for server_config in get_server_config_bulk(&db).await {
|
||||||
normal::update_server(&ctx, &server_config, &[], &[]).await;
|
normal::update_server(&ctx_task, &server_config, &[], &[]).await;
|
||||||
}
|
}
|
||||||
println!("User update - End");
|
println!("User update - End");
|
||||||
tokio::time::sleep(Duration::from_secs(60 * 5)).await;
|
tokio::time::sleep(Duration::from_secs(60 * 5)).await;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue