fixed a deadlock with use_cookie

This commit is contained in:
Baptiste de Montangon 2024-08-23 11:54:10 +02:00
parent eb73bff3cd
commit a90c96910f

View file

@ -188,22 +188,19 @@ where
if !has_expired { if !has_expired {
let ssr_cookies_header_getter = Arc::clone(&ssr_cookies_header_getter); let ssr_cookies_header_getter = Arc::clone(&ssr_cookies_header_getter);
jar.update_value(|jar| { let new_cookie = jar.try_update_value(|jar| {
if let Some(new_jar) = load_and_parse_cookie_jar(ssr_cookies_header_getter) { *jar = load_and_parse_cookie_jar(ssr_cookies_header_getter)?;
*jar = new_jar; jar.get(cookie_name)
.and_then(|c| {
set_cookie.set( C::decode(c.value())
jar.get(cookie_name) .map_err(|err| on_error(CodecError::Decode(err)))
.and_then(|c| { .ok()
C::decode(c.value()) })
.map_err(|err| on_error(CodecError::Decode(err))) .or(default_value)
.ok()
})
.or(default_value),
);
}
}); });
set_cookie.set(new_cookie.flatten());
handle_expiration(delay, set_cookie); handle_expiration(delay, set_cookie);
} else { } else {
debug_warn!( debug_warn!(