From e901579b00fbcd8fc0f7b45fd841636329148a34 Mon Sep 17 00:00:00 2001 From: Chocobozzz Date: Wed, 17 May 2023 16:42:57 +0200 Subject: Fix tests --- server/initializers/constants.ts | 5 ++++- server/lib/runners/runner.ts | 3 ++- server/tests/api/check-params/video-captions.ts | 2 +- server/tests/api/notifications/moderation-notifications.ts | 2 +- server/tests/api/notifications/registrations-notifications.ts | 2 +- server/tests/api/search/search-videos.ts | 2 +- 6 files changed, 10 insertions(+), 6 deletions(-) diff --git a/server/initializers/constants.ts b/server/initializers/constants.ts index 46455dd5b..85944fa3a 100644 --- a/server/initializers/constants.ts +++ b/server/initializers/constants.ts @@ -257,7 +257,8 @@ const JOB_REMOVAL_OPTIONS = { const VIDEO_IMPORT_TIMEOUT = Math.floor(JOB_TTL['video-import'] * 0.9) const RUNNER_JOBS = { - MAX_FAILURES: 5 + MAX_FAILURES: 5, + LAST_CONTACT_UPDATE_INTERVAL: 30000 } // --------------------------------------------------------------------------- @@ -1034,6 +1035,8 @@ if (process.env.PRODUCTION_CONSTANTS !== 'true') { VIDEO_LIVE.SEGMENT_TIME_SECONDS.DEFAULT_LATENCY = 2 VIDEO_LIVE.SEGMENT_TIME_SECONDS.SMALL_LATENCY = 1 VIDEO_LIVE.EDGE_LIVE_DELAY_SEGMENTS_NOTIFICATION = 1 + + RUNNER_JOBS.LAST_CONTACT_UPDATE_INTERVAL = 2000 } } diff --git a/server/lib/runners/runner.ts b/server/lib/runners/runner.ts index 5478ab519..921cae6f2 100644 --- a/server/lib/runners/runner.ts +++ b/server/lib/runners/runner.ts @@ -3,6 +3,7 @@ import { retryTransactionWrapper } from '@server/helpers/database-utils' import { logger, loggerTagsFactory } from '@server/helpers/logger' import { sequelizeTypescript } from '@server/initializers/database' import { MRunner } from '@server/types/models/runners' +import { RUNNER_JOBS } from '@server/initializers/constants' const lTags = loggerTagsFactory('runner') @@ -12,7 +13,7 @@ function updateLastRunnerContact (req: express.Request, runner: MRunner) { const now = new Date() // Don't update last runner contact too often - if (now.getTime() - runner.lastContact.getTime() < 30000) return + if (now.getTime() - runner.lastContact.getTime() < RUNNER_JOBS.LAST_CONTACT_UPDATE_INTERVAL) return if (updatingRunner.has(runner.id)) return updatingRunner.add(runner.id) diff --git a/server/tests/api/check-params/video-captions.ts b/server/tests/api/check-params/video-captions.ts index bfce5ca47..532dab1c4 100644 --- a/server/tests/api/check-params/video-captions.ts +++ b/server/tests/api/check-params/video-captions.ts @@ -23,7 +23,7 @@ describe('Test video captions API validator', function () { // --------------------------------------------------------------- before(async function () { - this.timeout(30000) + this.timeout(120000) server = await createSingleServer(1) diff --git a/server/tests/api/notifications/moderation-notifications.ts b/server/tests/api/notifications/moderation-notifications.ts index fa75182e1..d80de821e 100644 --- a/server/tests/api/notifications/moderation-notifications.ts +++ b/server/tests/api/notifications/moderation-notifications.ts @@ -33,7 +33,7 @@ describe('Test moderation notifications', function () { let emails: object[] = [] before(async function () { - this.timeout(50000) + this.timeout(120000) const res = await prepareNotificationsTest(3) emails = res.emails diff --git a/server/tests/api/notifications/registrations-notifications.ts b/server/tests/api/notifications/registrations-notifications.ts index b5a7c2bb5..d20fc8df3 100644 --- a/server/tests/api/notifications/registrations-notifications.ts +++ b/server/tests/api/notifications/registrations-notifications.ts @@ -21,7 +21,7 @@ describe('Test registrations notifications', function () { let baseParams: CheckerBaseParams before(async function () { - this.timeout(50000) + this.timeout(120000) const res = await prepareNotificationsTest(1) diff --git a/server/tests/api/search/search-videos.ts b/server/tests/api/search/search-videos.ts index 5e85e3aa7..66c462942 100644 --- a/server/tests/api/search/search-videos.ts +++ b/server/tests/api/search/search-videos.ts @@ -26,7 +26,7 @@ describe('Test videos search', function () { let command: SearchCommand before(async function () { - this.timeout(240000) + this.timeout(360000) const servers = await Promise.all([ createSingleServer(1), -- cgit v1.2.3