Fix guaranteed deadlock when refreshing token during webhook handling
continuous-integration/drone the build was successful Details

This commit is contained in:
Olivier 'reivilibre' 2021-11-26 20:11:28 +00:00
parent eef55632bb
commit e8fcd33a01
1 changed files with 2 additions and 0 deletions

View File

@ -177,6 +177,8 @@ async fn monzo_hook(hook: MonzoHook, state: State) -> anyhow::Result<impl warp::
.unwrap_or("unk"); .unwrap_or("unk");
buf.push_str(&format!(" on {}", on_account_name)); buf.push_str(&format!(" on {}", on_account_name));
// MUST drop state_inner to avoid deadlock
drop(state_inner);
if let Some(monzo_client) = monzo_client_freshened(&state).await? { if let Some(monzo_client) = monzo_client_freshened(&state).await? {
// include new balance // include new balance
match monzo_client.balance(&txn_created.account_id).await { match monzo_client.balance(&txn_created.account_id).await {