From 95022ca95b1d2792bae447d90694dcc0d67b9de2 Mon Sep 17 00:00:00 2001 From: fusion32 Date: Thu, 16 Oct 2025 01:35:10 -0300 Subject: lower monotonic uptime resolution from MILLISECONDS to SECONDS The monotonic uptime was used exclusively with caches and having a resolution of SECONDS allows it to be stored as an int without risk of wrapping (~68 years). Using MILLISECONDS meant that it would wrap after ~25 days which is totally possible and EXPECTED. Just as an example, the small test server I ran for about 1 month had ZERO downtime on the QueryManager except for when I manually restarted it. It was probably very close to wrapping when I took it down. --- src/database_postgres.cc | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src/database_postgres.cc') diff --git a/src/database_postgres.cc b/src/database_postgres.cc index 4638851..bcadcea 100644 --- a/src/database_postgres.cc +++ b/src/database_postgres.cc @@ -1051,7 +1051,7 @@ const char *PrepareQuery(TDatabase *Database, const char *Text){ if(Entry->Text != NULL && Entry->Hash == Hash){ if(StringEq(Entry->Text, Text)){ Stmt = Entry; - Entry->LastUsed = GetMonotonicUptimeMS(); + Entry->LastUsed = GetMonotonicUptime(); break; } } @@ -1085,7 +1085,7 @@ const char *PrepareQuery(TDatabase *Database, const char *Text){ } - Stmt->LastUsed = GetMonotonicUptimeMS(); + Stmt->LastUsed = GetMonotonicUptime(); Stmt->Hash = Hash; Stmt->Text = strdup(Text); ASSERT(Stmt->Text != NULL); -- cgit v1.2.3