disable caching during error handling

This has the effect of reducing a warning log since we are not
leaving the lock dangling for the next reader.
This commit is contained in:
Matthew Gumport 2024-08-27 00:31:53 -07:00 committed by Edward Wang
parent 4446912080
commit 5e3e774a8d
3 changed files with 3 additions and 4 deletions

2
.bleep
View file

@ -1 +1 @@
b0ee94e1ce384cb2d23a40bf6c7a4b7e32541412
30c624970d46b07efd110fcfb8dd0b6f9a099e2b

View file

@ -607,6 +607,8 @@ impl<SV> HttpProxy<SV> {
};
if let Some(e) = final_error.as_ref() {
// If we have errored and are still holding a cache lock, release it.
session.cache.disable(NoCacheReason::InternalError);
let status = self.inner.fail_to_proxy(&mut session, e, &mut ctx).await;
// final error will have > 0 status unless downstream connection is dead

View file

@ -1077,9 +1077,6 @@ mod test_cache {
init();
let url = "http://127.0.0.1:6148/sleep/test_cache_lock_network_error.txt";
// FIXME: Dangling lock happens in this test because the first request aborted without
// properly release the lock. This is a bug
let task1 = tokio::spawn(async move {
let res = reqwest::Client::new()
.get(url)