diff options
Diffstat (limited to 'server/lib')
-rw-r--r-- | server/lib/client-html.ts | 4 | ||||
-rw-r--r-- | server/lib/emailer.ts | 6 | ||||
-rw-r--r-- | server/lib/job-queue/handlers/video-views-stats.ts | 4 | ||||
-rw-r--r-- | server/lib/schedulers/actor-follow-scheduler.ts | 4 | ||||
-rw-r--r-- | server/lib/schedulers/remove-old-jobs-scheduler.ts | 6 | ||||
-rw-r--r-- | server/lib/views/shared/video-viewer-counters.ts | 4 | ||||
-rw-r--r-- | server/lib/views/shared/video-viewer-stats.ts | 4 |
7 files changed, 16 insertions, 16 deletions
diff --git a/server/lib/client-html.ts b/server/lib/client-html.ts index 1e8d03023..899d80c15 100644 --- a/server/lib/client-html.ts +++ b/server/lib/client-html.ts | |||
@@ -2,6 +2,7 @@ import express from 'express' | |||
2 | import { readFile } from 'fs-extra' | 2 | import { readFile } from 'fs-extra' |
3 | import { join } from 'path' | 3 | import { join } from 'path' |
4 | import validator from 'validator' | 4 | import validator from 'validator' |
5 | import { isTestOrDevInstance } from '@server/helpers/core-utils' | ||
5 | import { toCompleteUUID } from '@server/helpers/custom-validators/misc' | 6 | import { toCompleteUUID } from '@server/helpers/custom-validators/misc' |
6 | import { mdToOneLinePlainText } from '@server/helpers/markdown' | 7 | import { mdToOneLinePlainText } from '@server/helpers/markdown' |
7 | import { ActorImageModel } from '@server/models/actor/actor-image' | 8 | import { ActorImageModel } from '@server/models/actor/actor-image' |
@@ -30,7 +31,6 @@ import { MAccountActor, MChannelActor } from '../types/models' | |||
30 | import { getActivityStreamDuration } from './activitypub/activity' | 31 | import { getActivityStreamDuration } from './activitypub/activity' |
31 | import { getBiggestActorImage } from './actor-image' | 32 | import { getBiggestActorImage } from './actor-image' |
32 | import { ServerConfigManager } from './server-config-manager' | 33 | import { ServerConfigManager } from './server-config-manager' |
33 | import { isTestInstance } from '@server/helpers/core-utils' | ||
34 | 34 | ||
35 | type Tags = { | 35 | type Tags = { |
36 | ogType: string | 36 | ogType: string |
@@ -234,7 +234,7 @@ class ClientHtml { | |||
234 | const path = ClientHtml.getEmbedPath() | 234 | const path = ClientHtml.getEmbedPath() |
235 | 235 | ||
236 | // Disable HTML cache in dev mode because webpack can regenerate JS files | 236 | // Disable HTML cache in dev mode because webpack can regenerate JS files |
237 | if (!isTestInstance() && ClientHtml.htmlCache[path]) { | 237 | if (!isTestOrDevInstance() && ClientHtml.htmlCache[path]) { |
238 | return ClientHtml.htmlCache[path] | 238 | return ClientHtml.htmlCache[path] |
239 | } | 239 | } |
240 | 240 | ||
diff --git a/server/lib/emailer.ts b/server/lib/emailer.ts index edc99057c..42d7650dd 100644 --- a/server/lib/emailer.ts +++ b/server/lib/emailer.ts | |||
@@ -2,10 +2,10 @@ import { readFileSync } from 'fs-extra' | |||
2 | import { isArray, merge } from 'lodash' | 2 | import { isArray, merge } from 'lodash' |
3 | import { createTransport, Transporter } from 'nodemailer' | 3 | import { createTransport, Transporter } from 'nodemailer' |
4 | import { join } from 'path' | 4 | import { join } from 'path' |
5 | import { root } from '@shared/core-utils' | ||
5 | import { EmailPayload } from '@shared/models' | 6 | import { EmailPayload } from '@shared/models' |
6 | import { SendEmailDefaultOptions } from '../../shared/models/server/emailer.model' | 7 | import { SendEmailDefaultOptions } from '../../shared/models/server/emailer.model' |
7 | import { isTestInstance } from '../helpers/core-utils' | 8 | import { isTestOrDevInstance } from '../helpers/core-utils' |
8 | import { root } from '@shared/core-utils' | ||
9 | import { bunyanLogger, logger } from '../helpers/logger' | 9 | import { bunyanLogger, logger } from '../helpers/logger' |
10 | import { CONFIG, isEmailEnabled } from '../initializers/config' | 10 | import { CONFIG, isEmailEnabled } from '../initializers/config' |
11 | import { WEBSERVER } from '../initializers/constants' | 11 | import { WEBSERVER } from '../initializers/constants' |
@@ -29,7 +29,7 @@ class Emailer { | |||
29 | this.initialized = true | 29 | this.initialized = true |
30 | 30 | ||
31 | if (!isEmailEnabled()) { | 31 | if (!isEmailEnabled()) { |
32 | if (!isTestInstance()) { | 32 | if (!isTestOrDevInstance()) { |
33 | logger.error('Cannot use SMTP server because of lack of configuration. PeerTube will not be able to send mails!') | 33 | logger.error('Cannot use SMTP server because of lack of configuration. PeerTube will not be able to send mails!') |
34 | } | 34 | } |
35 | 35 | ||
diff --git a/server/lib/job-queue/handlers/video-views-stats.ts b/server/lib/job-queue/handlers/video-views-stats.ts index 689a5a3b4..c9aa218e5 100644 --- a/server/lib/job-queue/handlers/video-views-stats.ts +++ b/server/lib/job-queue/handlers/video-views-stats.ts | |||
@@ -1,5 +1,5 @@ | |||
1 | import { VideoViewModel } from '@server/models/view/video-view' | 1 | import { VideoViewModel } from '@server/models/view/video-view' |
2 | import { isTestInstance } from '../../../helpers/core-utils' | 2 | import { isTestOrDevInstance } from '../../../helpers/core-utils' |
3 | import { logger } from '../../../helpers/logger' | 3 | import { logger } from '../../../helpers/logger' |
4 | import { VideoModel } from '../../../models/video/video' | 4 | import { VideoModel } from '../../../models/video/video' |
5 | import { Redis } from '../../redis' | 5 | import { Redis } from '../../redis' |
@@ -8,7 +8,7 @@ async function processVideosViewsStats () { | |||
8 | const lastHour = new Date() | 8 | const lastHour = new Date() |
9 | 9 | ||
10 | // In test mode, we run this function multiple times per hour, so we don't want the values of the previous hour | 10 | // In test mode, we run this function multiple times per hour, so we don't want the values of the previous hour |
11 | if (!isTestInstance()) lastHour.setHours(lastHour.getHours() - 1) | 11 | if (!isTestOrDevInstance()) lastHour.setHours(lastHour.getHours() - 1) |
12 | 12 | ||
13 | const hour = lastHour.getHours() | 13 | const hour = lastHour.getHours() |
14 | const startDate = lastHour.setMinutes(0, 0, 0) | 14 | const startDate = lastHour.setMinutes(0, 0, 0) |
diff --git a/server/lib/schedulers/actor-follow-scheduler.ts b/server/lib/schedulers/actor-follow-scheduler.ts index 560f97f3e..e1c56c135 100644 --- a/server/lib/schedulers/actor-follow-scheduler.ts +++ b/server/lib/schedulers/actor-follow-scheduler.ts | |||
@@ -1,4 +1,4 @@ | |||
1 | import { isTestInstance } from '../../helpers/core-utils' | 1 | import { isTestOrDevInstance } from '../../helpers/core-utils' |
2 | import { logger } from '../../helpers/logger' | 2 | import { logger } from '../../helpers/logger' |
3 | import { ACTOR_FOLLOW_SCORE, SCHEDULER_INTERVALS_MS } from '../../initializers/constants' | 3 | import { ACTOR_FOLLOW_SCORE, SCHEDULER_INTERVALS_MS } from '../../initializers/constants' |
4 | import { ActorFollowModel } from '../../models/actor/actor-follow' | 4 | import { ActorFollowModel } from '../../models/actor/actor-follow' |
@@ -39,7 +39,7 @@ export class ActorFollowScheduler extends AbstractScheduler { | |||
39 | } | 39 | } |
40 | 40 | ||
41 | private async removeBadActorFollows () { | 41 | private async removeBadActorFollows () { |
42 | if (!isTestInstance()) logger.info('Removing bad actor follows (scheduler).') | 42 | if (!isTestOrDevInstance()) logger.info('Removing bad actor follows (scheduler).') |
43 | 43 | ||
44 | try { | 44 | try { |
45 | await ActorFollowModel.removeBadActorFollows() | 45 | await ActorFollowModel.removeBadActorFollows() |
diff --git a/server/lib/schedulers/remove-old-jobs-scheduler.ts b/server/lib/schedulers/remove-old-jobs-scheduler.ts index dffef3542..879846999 100644 --- a/server/lib/schedulers/remove-old-jobs-scheduler.ts +++ b/server/lib/schedulers/remove-old-jobs-scheduler.ts | |||
@@ -1,8 +1,8 @@ | |||
1 | import { isTestInstance } from '../../helpers/core-utils' | 1 | import { isTestOrDevInstance } from '../../helpers/core-utils' |
2 | import { logger } from '../../helpers/logger' | 2 | import { logger } from '../../helpers/logger' |
3 | import { SCHEDULER_INTERVALS_MS } from '../../initializers/constants' | ||
3 | import { JobQueue } from '../job-queue' | 4 | import { JobQueue } from '../job-queue' |
4 | import { AbstractScheduler } from './abstract-scheduler' | 5 | import { AbstractScheduler } from './abstract-scheduler' |
5 | import { SCHEDULER_INTERVALS_MS } from '../../initializers/constants' | ||
6 | 6 | ||
7 | export class RemoveOldJobsScheduler extends AbstractScheduler { | 7 | export class RemoveOldJobsScheduler extends AbstractScheduler { |
8 | 8 | ||
@@ -15,7 +15,7 @@ export class RemoveOldJobsScheduler extends AbstractScheduler { | |||
15 | } | 15 | } |
16 | 16 | ||
17 | protected internalExecute () { | 17 | protected internalExecute () { |
18 | if (!isTestInstance()) logger.info('Removing old jobs in scheduler.') | 18 | if (!isTestOrDevInstance()) logger.info('Removing old jobs in scheduler.') |
19 | 19 | ||
20 | return JobQueue.Instance.removeOldJobs() | 20 | return JobQueue.Instance.removeOldJobs() |
21 | } | 21 | } |
diff --git a/server/lib/views/shared/video-viewer-counters.ts b/server/lib/views/shared/video-viewer-counters.ts index cf3fa5882..f851ce050 100644 --- a/server/lib/views/shared/video-viewer-counters.ts +++ b/server/lib/views/shared/video-viewer-counters.ts | |||
@@ -1,4 +1,4 @@ | |||
1 | import { isTestInstance } from '@server/helpers/core-utils' | 1 | import { isTestOrDevInstance } from '@server/helpers/core-utils' |
2 | import { logger, loggerTagsFactory } from '@server/helpers/logger' | 2 | import { logger, loggerTagsFactory } from '@server/helpers/logger' |
3 | import { VIEW_LIFETIME } from '@server/initializers/constants' | 3 | import { VIEW_LIFETIME } from '@server/initializers/constants' |
4 | import { sendView } from '@server/lib/activitypub/send/send-view' | 4 | import { sendView } from '@server/lib/activitypub/send/send-view' |
@@ -117,7 +117,7 @@ export class VideoViewerCounters { | |||
117 | if (this.processingViewerCounters) return | 117 | if (this.processingViewerCounters) return |
118 | this.processingViewerCounters = true | 118 | this.processingViewerCounters = true |
119 | 119 | ||
120 | if (!isTestInstance()) logger.info('Cleaning video viewers.', lTags()) | 120 | if (!isTestOrDevInstance()) logger.info('Cleaning video viewers.', lTags()) |
121 | 121 | ||
122 | try { | 122 | try { |
123 | for (const videoId of this.viewersPerVideo.keys()) { | 123 | for (const videoId of this.viewersPerVideo.keys()) { |
diff --git a/server/lib/views/shared/video-viewer-stats.ts b/server/lib/views/shared/video-viewer-stats.ts index a56c20559..542bd51cf 100644 --- a/server/lib/views/shared/video-viewer-stats.ts +++ b/server/lib/views/shared/video-viewer-stats.ts | |||
@@ -1,5 +1,5 @@ | |||
1 | import { Transaction } from 'sequelize/types' | 1 | import { Transaction } from 'sequelize/types' |
2 | import { isTestInstance } from '@server/helpers/core-utils' | 2 | import { isTestOrDevInstance } from '@server/helpers/core-utils' |
3 | import { GeoIP } from '@server/helpers/geo-ip' | 3 | import { GeoIP } from '@server/helpers/geo-ip' |
4 | import { logger, loggerTagsFactory } from '@server/helpers/logger' | 4 | import { logger, loggerTagsFactory } from '@server/helpers/logger' |
5 | import { MAX_LOCAL_VIEWER_WATCH_SECTIONS, VIEW_LIFETIME } from '@server/initializers/constants' | 5 | import { MAX_LOCAL_VIEWER_WATCH_SECTIONS, VIEW_LIFETIME } from '@server/initializers/constants' |
@@ -118,7 +118,7 @@ export class VideoViewerStats { | |||
118 | if (this.processingViewersStats) return | 118 | if (this.processingViewersStats) return |
119 | this.processingViewersStats = true | 119 | this.processingViewersStats = true |
120 | 120 | ||
121 | if (!isTestInstance()) logger.info('Processing viewer statistics.', lTags()) | 121 | if (!isTestOrDevInstance()) logger.info('Processing viewer statistics.', lTags()) |
122 | 122 | ||
123 | const now = new Date().getTime() | 123 | const now = new Date().getTime() |
124 | 124 | ||