From fca7283671741bb445ead6d6d7496d9977d0405b Mon Sep 17 00:00:00 2001 From: Claus-Peter Huebner Date: Wed, 2 Aug 2023 23:14:49 +0200 Subject: [PATCH] delete foreign federated community entries on startCommunityValidation --- backend/src/federation/validateCommunities.ts | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/backend/src/federation/validateCommunities.ts b/backend/src/federation/validateCommunities.ts index 91c6ee724..f4b52c5dc 100644 --- a/backend/src/federation/validateCommunities.ts +++ b/backend/src/federation/validateCommunities.ts @@ -10,10 +10,13 @@ import { backendLogger as logger } from '@/server/logger' import { ApiVersionType } from './enum/apiVersionType' -export function startValidateCommunities(timerInterval: number): void { +export async function startValidateCommunities(timerInterval: number): Promise { logger.info( `Federation: startValidateCommunities loop with an interval of ${timerInterval} ms...`, ) + // delete all foreign federated community entries to avoid increasing validation efforts and log-files + await DbFederatedCommunity.delete({ foreign: true }) + // TODO: replace the timer-loop by an event-based communication to verify announced foreign communities // better to use setTimeout twice than setInterval once -> see https://javascript.info/settimeout-setinterval setTimeout(function run() {