replace ?? with ||, check if FEDERATION_VALIDATE_COMMUNITY_TIMER is valid number

This commit is contained in:
einhornimmond 2024-02-15 18:17:14 +01:00
parent eedd9fa3ac
commit aeb7a7d2be
2 changed files with 6 additions and 2 deletions

View File

@ -128,8 +128,8 @@ if (
const federation = {
FEDERATION_BACKEND_SEND_ON_API: process.env.FEDERATION_BACKEND_SEND_ON_API ?? '1_0',
FEDERATION_VALIDATE_COMMUNITY_TIMER:
Number(process.env.FEDERATION_VALIDATE_COMMUNITY_TIMER) ?? 60000,
FEDERATION_VALIDATE_COMMUNITY_TIMER: // ?? operator don't work here as expected
Number(process.env.FEDERATION_VALIDATE_COMMUNITY_TIMER) || 60000,
FEDERATION_XCOM_SENDCOINS_ENABLED:
process.env.FEDERATION_XCOM_SENDCOINS_ENABLED === 'true' ?? false,
// default value for community-uuid is equal uuid of stage-3

View File

@ -13,8 +13,12 @@ import { backendLogger as logger } from '@/server/logger'
import { startCommunityAuthentication } from './authenticateCommunities'
import { PublicCommunityInfoLoggingView } from './client/1_0/logging/PublicCommunityInfoLogging.view'
import { ApiVersionType } from './enum/apiVersionType'
import { LogError } from '@/server/LogError'
export async function startValidateCommunities(timerInterval: number): Promise<void> {
if (Number.isNaN(timerInterval) || timerInterval <= 0) {
throw new LogError('FEDERATION_VALIDATE_COMMUNITY_TIMER is not a positive number')
}
logger.info(
`Federation: startValidateCommunities loop with an interval of ${timerInterval} ms...`,
)