Spot the bug in the async cache refresh

from Rust backend development
Rust 1.98 advanced 4 min 2 issues to find

This async function should refresh one cache entry without blocking unrelated requests. Find the two concurrency problems.

Rust
use std::{collections::HashMap, sync::{Arc, Mutex}};

async fn refresh(cache: Arc<Mutex<HashMap<u64, String>>>, user_id: u64) {
    let mut entries = cache.lock().unwrap();
    entries.insert(user_id, "refreshing".to_string());
    let profile = fetch_profile(user_id).await;
    entries.insert(user_id, profile);
}
Open in playground
Report an error