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 {
let ssr_cookies_header_getter = Arc::clone(&ssr_cookies_header_getter);
jar.update_value(|jar| {
if let Some(new_jar) = load_and_parse_cookie_jar(ssr_cookies_header_getter) {
*jar = new_jar;
set_cookie.set(
let new_cookie = jar.try_update_value(|jar| {
*jar = load_and_parse_cookie_jar(ssr_cookies_header_getter)?;
jar.get(cookie_name)
.and_then(|c| {
C::decode(c.value())
.map_err(|err| on_error(CodecError::Decode(err)))
.ok()
})
.or(default_value),
);
}
.or(default_value)
});
set_cookie.set(new_cookie.flatten());
handle_expiration(delay, set_cookie);
} else {
debug_warn!(