Merge pull request #21 from mini-bomba/set_lastupdate_on_already_updated

Set player_info.last_update when no update was required
This commit is contained in:
techmetx11 2024-08-17 16:55:58 +00:00 committed by GitHub
commit 52097ac1cc
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -39,12 +39,13 @@ pub async fn fetch_update(state: Arc<GlobalState>) -> Result<(), FetchUpdateStat
let mut current_player_info = global_state.player_info.lock().await;
let current_player_id = current_player_info.player_id;
// release the mutex for other tasks
drop(current_player_info);
if player_id == current_player_id {
current_player_info.last_update = SystemTime::now();
return Err(FetchUpdateStatus::PlayerAlreadyUpdated);
}
// release the mutex for other tasks
drop(current_player_info);
// Download the player script
let player_js_url: String = format!(