mirror of
https://github.com/natsukagami/youmubot.git
synced 2025-04-19 00:38:54 +00:00
Properly release lock on user header...
This commit is contained in:
parent
8e7b2b75e8
commit
fdeba634f4
2 changed files with 6 additions and 4 deletions
|
@ -197,6 +197,7 @@ pub async fn mania(ctx: &Context, msg: &Message, args: Args) -> CommandResult {
|
|||
get_user(ctx, &env, msg, args, Mode::Mania).await
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone)]
|
||||
pub(crate) struct BeatmapWithMode(pub Beatmap, pub Mode);
|
||||
|
||||
impl BeatmapWithMode {
|
||||
|
|
|
@ -73,12 +73,13 @@ impl Client {
|
|||
|
||||
/// Fetch the user header.
|
||||
pub async fn user_header(&self, id: u64) -> Result<Option<UserHeader>, Error> {
|
||||
Ok(
|
||||
match self.user_header_cache.lock().await.get(&id).cloned() {
|
||||
Ok({
|
||||
let v = self.user_header_cache.lock().await.get(&id).cloned();
|
||||
match v {
|
||||
Some(v) => v,
|
||||
None => self.user(UserID::ID(id), |f| f).await?.map(|v| v.into()),
|
||||
},
|
||||
)
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
pub async fn scores(
|
||||
|
|
Loading…
Add table
Reference in a new issue