mirror of
https://github.com/natsukagami/youmubot.git
synced 2025-04-19 16:58:55 +00:00
Try for a quick re-lock of the db in the announceer
This commit is contained in:
parent
ea75818c99
commit
822f07954f
1 changed files with 13 additions and 4 deletions
|
@ -45,10 +45,12 @@ impl youmubot_prelude::Announcer for Announcer {
|
||||||
channels: MemberToChannels,
|
channels: MemberToChannels,
|
||||||
) -> Result<()> {
|
) -> Result<()> {
|
||||||
// For each user...
|
// For each user...
|
||||||
|
let users = {
|
||||||
let data = d.read().await;
|
let data = d.read().await;
|
||||||
let data = data.get::<OsuSavedUsers>().unwrap();
|
let data = data.get::<OsuSavedUsers>().unwrap();
|
||||||
|
data.all().await?
|
||||||
|
};
|
||||||
let now = chrono::Utc::now();
|
let now = chrono::Utc::now();
|
||||||
let users = data.all().await?;
|
|
||||||
users
|
users
|
||||||
.into_iter()
|
.into_iter()
|
||||||
.map(|mut osu_user| {
|
.map(|mut osu_user| {
|
||||||
|
@ -78,7 +80,14 @@ impl youmubot_prelude::Announcer for Announcer {
|
||||||
println!("scanning {} done", osu_user.id);
|
println!("scanning {} done", osu_user.id);
|
||||||
osu_user.last_update = now;
|
osu_user.last_update = now;
|
||||||
osu_user.pp = v.try_into().unwrap();
|
osu_user.pp = v.try_into().unwrap();
|
||||||
data.save(osu_user).await.pls_ok();
|
ctx.data
|
||||||
|
.read()
|
||||||
|
.await
|
||||||
|
.get::<OsuSavedUsers>()
|
||||||
|
.unwrap()
|
||||||
|
.save(osu_user)
|
||||||
|
.await
|
||||||
|
.pls_ok();
|
||||||
}
|
}
|
||||||
Err(e) => {
|
Err(e) => {
|
||||||
eprintln!("osu: Cannot update {}: {}", osu_user.id, e);
|
eprintln!("osu: Cannot update {}: {}", osu_user.id, e);
|
||||||
|
|
Loading…
Add table
Reference in a new issue