0
0
Fork 0
mirror of https://github.com/matrix-construct/construct synced 2024-09-28 11:48:54 +02:00

modules/m_room_aliases: Clarify expiration calculation; log dwarning.

This commit is contained in:
Jason Volk 2019-07-23 20:46:26 -07:00
parent eb3b4d82fb
commit 8f0a71f677

View file

@ -311,8 +311,31 @@ ircd::m::room::aliases::cache::get(std::nothrow_t,
if(!m::get(event_idx, "origin_server_ts", ts))
return false;
if(!my_host(alias.host()) && ircd::time() - ts > seconds(alias_cache_ttl).count())
const seconds &elapsed
{
(ircd::time<milliseconds>() - ts) / 1000L
};
const seconds &ttl
{
alias_cache_ttl
};
const bool expired
{
!my_host(alias.host()) && elapsed > ttl
};
if(expired)
{
log::dwarning
{
log, "Cached alias %s expired elapsed:%ld ttl:%ld",
string_view{alias},
elapsed.count(),
ttl.count(),
};
fetch(std::nothrow, alias, alias.host());
event_idx = alias_room.get(std::nothrow, "ircd.room.alias", key);
}