mirror of
https://git.asonix.dog/asonix/relay.git
synced 2024-11-20 00:21:03 +00:00
Bump duration for actor cache to 30 minutes
This commit is contained in:
parent
a52a32db8d
commit
69ec2baf79
1 changed files with 9 additions and 11 deletions
|
@ -6,7 +6,7 @@ use tokio::sync::RwLock;
|
||||||
use ttl_cache::TtlCache;
|
use ttl_cache::TtlCache;
|
||||||
use uuid::Uuid;
|
use uuid::Uuid;
|
||||||
|
|
||||||
const REFETCH_DURATION: u64 = 60 * 2;
|
const REFETCH_DURATION: Duration = Duration::from_secs(60 * 30);
|
||||||
|
|
||||||
#[derive(Clone)]
|
#[derive(Clone)]
|
||||||
pub struct ActorCache {
|
pub struct ActorCache {
|
||||||
|
@ -38,11 +38,10 @@ impl ActorCache {
|
||||||
}
|
}
|
||||||
|
|
||||||
if let Some(actor) = self.lookup(id).await? {
|
if let Some(actor) = self.lookup(id).await? {
|
||||||
self.cache.write().await.insert(
|
self.cache
|
||||||
id.clone(),
|
.write()
|
||||||
actor.clone(),
|
.await
|
||||||
Duration::from_secs(REFETCH_DURATION),
|
.insert(id.clone(), actor.clone(), REFETCH_DURATION);
|
||||||
);
|
|
||||||
return Ok(actor);
|
return Ok(actor);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -67,11 +66,10 @@ impl ActorCache {
|
||||||
inbox,
|
inbox,
|
||||||
};
|
};
|
||||||
|
|
||||||
self.cache.write().await.insert(
|
self.cache
|
||||||
id.clone(),
|
.write()
|
||||||
actor.clone(),
|
.await
|
||||||
Duration::from_secs(REFETCH_DURATION),
|
.insert(id.clone(), actor.clone(), REFETCH_DURATION);
|
||||||
);
|
|
||||||
|
|
||||||
self.update(id, &actor.public_key, &actor.public_key_id)
|
self.update(id, &actor.public_key, &actor.public_key_id)
|
||||||
.await?;
|
.await?;
|
||||||
|
|
Loading…
Reference in a new issue