From 1e353bfe7a9daa70259fd543c44fcd8be9f46d00 Mon Sep 17 00:00:00 2001 From: Robert Adams Date: Tue, 15 Jun 2021 10:22:15 -0700 Subject: [PATCH] Places: minor tweeking to how last activity time is computed for a Place Now only updated by periodic Place activity check process. --- src/Entities/Places.ts | 13 ++----------- src/config.ts | 4 ++-- src/route-tools/Util.ts | 11 ++--------- 3 files changed, 6 insertions(+), 22 deletions(-) diff --git a/src/Entities/Places.ts b/src/Entities/Places.ts index 0bbe90f2..0de6824e 100755 --- a/src/Entities/Places.ts +++ b/src/Entities/Places.ts @@ -78,17 +78,8 @@ export function initPlaces(): void { aPlace.currentAttendance = domainAttendance; updates.currentAttendance = aPlace.currentAttendance; }; - // If the Place doesn't have a last activity set it to the domain's - if (IsNullOrEmpty(aPlace.lastActivity)) { - if (IsNullOrEmpty(aDomain.timeOfLastHeartbeat)) { - // If the domain doesn't have a last update time either, assume stale Place - aPlace.lastActivity = inactivePlaceTime; - } - else { - aPlace.lastActivity = aDomain.timeOfLastHeartbeat; - }; - updates.lastActivity = aPlace.lastActivity; - }; + aPlace.lastActivity = aDomain.timeOfLastHeartbeat ?? inactivePlaceTime; + updates.lastActivity = aPlace.lastActivity; } else { // can't find the domain to go with the place. Set everything to zero and update DB diff --git a/src/config.ts b/src/config.ts index de8897b3..473ad75f 100755 --- a/src/config.ts +++ b/src/config.ts @@ -61,9 +61,9 @@ export let Config = { 'connection-request-expiration-minutes': 60 * 24 * 4, // 4 days 'friend-request-expiration-minutes': 60 * 24 * 4, // 4 days - 'place-current-timeout-minutes': 30, // minutes until current place info is stale + 'place-current-timeout-minutes': 5, // minutes until current place info is stale 'place-inactive-timeout-minutes': 60, // minutes until place is considered inactive - 'place-check-last-activity-seconds': (5*60)-5, // seconds between checks for Place lastActivity updates + 'place-check-last-activity-seconds': (3*60)-5, // seconds between checks for Place lastActivity updates // redirection URL used for initial domain token generation, // "METAVERSE_SERVER_URL" is replaced (from Config.metaverse.metaverse-server-url) diff --git a/src/route-tools/Util.ts b/src/route-tools/Util.ts index cf6156f5..74e94ecf 100755 --- a/src/route-tools/Util.ts +++ b/src/route-tools/Util.ts @@ -291,15 +291,8 @@ export async function buildPlaceInfoSmall(pPlace: PlaceEntity, pDomain?: DomainE 'current_attendance': pPlace.currentAttendance ?? 0, 'current_images': pPlace.currentImages, 'current_info': pPlace.currentInfo, - 'current_last_update_time': pPlace.currentLastUpdateTime - }; - // Return the domain's last heartbeat time if the current info has not been updated - if (IsNullOrEmpty(ret.current_last_update_time)) { - const thisDomain = pDomain ?? await Domains.getDomainWithId(pPlace.domainId); - if (thisDomain) { - const domainHeartbeat = thisDomain.timeOfLastHeartbeat; - ret.current_last_update_time = domainHeartbeat ? domainHeartbeat.toISOString() : undefined; - }; + 'current_last_update_time': pPlace.currentLastUpdateTime, + 'last_activity_update': pPlace.lastActivity }; return ret; };