Skip to content

Commit

Permalink
Places: add configuration for interval for checking Place lastActivit…
Browse files Browse the repository at this point in the history
…y timeout

    Tune times for inactivity and current info update activity.
  • Loading branch information
Misterblue committed Jun 14, 2021
1 parent c713094 commit 2319e07
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 5 deletions.
2 changes: 1 addition & 1 deletion src/Entities/Places.ts
Expand Up @@ -116,7 +116,7 @@ export function initPlaces(): void {
await Places.updateEntityFields(aPlace, updates);
};
// Logger.debug(`PlaceActivity: numPlaces=${numPlaces}, unhookedPlaces=${numUnhookedPlaces}, inactivePlaces=${numInactivePlaces}`);
}, 1000 * 58 );
}, 1000 * Config['metaverse-server']['place-check-last-activity-seconds'] );
};

export const Places = {
Expand Down
6 changes: 4 additions & 2 deletions src/config.ts
Expand Up @@ -61,8 +61,10 @@ 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': 60, // minutes until current place info is stale
'place-inactive-timeout-minutes': 60*24*7, // minutes until place is considered inactive
'place-current-timeout-minutes': 30, // 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

// redirection URL used for initial domain token generation,
// "METAVERSE_SERVER_URL" is replaced (from Config.metaverse.metaverse-server-url)
// "DASHBOARD_URL" is replaced (from Config.metaverse.dashboard-url)
Expand Down
3 changes: 1 addition & 2 deletions src/routes/api/maint/places.ts
Expand Up @@ -170,8 +170,7 @@ const procPlacesDeleteInactive: RequestHandler = async (req: Request, resp: Resp
};
// Return a stream of PlaceEntity's that do not have a domain or a domain that isn't addressable
async function *inactivePlaces(pPager: CriteriaFilter, pInfoer?: CriteriaFilter): AsyncGenerator<PlaceEntity> {
const inactivePlaceTime = new Date(Date.now()
- (Config['metaverse-server']['place-inactive-timeout-minutes'] * 60 * 1000));
const inactivePlaceTime = Places.dateWhenNotActive();
for await (const aPlace of Places.enumerateAsync(pPager, pInfoer)) {
if (IsNotNullOrEmpty(aPlace.lastActivity) || aPlace.lastActivity < inactivePlaceTime) {
yield aPlace;
Expand Down

0 comments on commit 2319e07

Please sign in to comment.