diff options
author | Stelios Fragkakis <52996999+stelfrag@users.noreply.github.com> | 2023-12-07 17:42:00 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-12-07 17:42:00 +0200 |
commit | f672c4b0a6d225a9d6e92f84fbfe3f14dd55b332 (patch) | |
tree | dceae2fe3f73b08b7979afceb9ab0b5c2285ae3a /database/sqlite/sqlite_aclk.c | |
parent | 3ac76d8d1bb7130c5fb915ccd36378734eb066ef (diff) |
Resolve issue on startup in servers with 1 core (#16565)
* Use at least one thread to do context load
Check for uninitialized last connected value
* Simplify / fix compilation warning
Diffstat (limited to 'database/sqlite/sqlite_aclk.c')
-rw-r--r-- | database/sqlite/sqlite_aclk.c | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/database/sqlite/sqlite_aclk.c b/database/sqlite/sqlite_aclk.c index 56b9574a92..ac574879cc 100644 --- a/database/sqlite/sqlite_aclk.c +++ b/database/sqlite/sqlite_aclk.c @@ -80,7 +80,12 @@ static int create_host_callback(void *data, int argc, char **argv, char **column UNUSED(argc); UNUSED(column); - time_t last_connected = (time_t) (argv[IDX_LAST_CONNECTED] ? str2uint64_t(argv[IDX_LAST_CONNECTED], NULL) : 0); + time_t last_connected = + (time_t)(argv[IDX_LAST_CONNECTED] ? str2uint64_t(argv[IDX_LAST_CONNECTED], NULL) : 0); + + if (!last_connected) + last_connected = now_realtime_sec(); + time_t age = now_realtime_sec() - last_connected; int is_ephemeral = 0; |