mirror of
https://forgejo.ellis.link/continuwuation/continuwuity/
synced 2026-10-23 02:01:21 +00:00
add back the consume_budget on cache hits
Signed-off-by: Jason Volk <jason@zemos.net>
This commit is contained in:
1 parent
6aa35260e6
commit
ff56ee7413
1 file changed
+5
-2
@@ -2,8 +2,9 @@
|
||||
|
||||
use arrayvec::ArrayVec;
|
||||
use conduit::{err, implement, utils::result::MapExpect, Err, Result};
|
||||
use futures::{future, Future, FutureExt};
|
||||
use futures::{Future, FutureExt};
|
||||
use serde::Serialize;
|
||||
use tokio::task;
|
||||
|
||||
use crate::{
|
||||
keyval::KeyBuf,
|
||||
@@ -63,7 +64,9 @@ pub fn get<K>(self: &Arc<Self>, key: &K) -> impl Future<Output = Result<Handle<'
|
||||
|
||||
let cached = self.get_cached(key);
|
||||
if matches!(cached, Err(_) | Ok(Some(_))) {
|
||||
return future::ready(cached.map_expect("data found in cache")).boxed();
|
||||
return task::consume_budget()
|
||||
.map(move |()| cached.map_expect("data found in cache"))
|
||||
.boxed();
|
||||
}
|
||||
|
||||
debug_assert!(matches!(cached, Ok(None)), "expected status Incomplete");
|
||||
|
||||
Reference in new issue
Block a user