don't log metrics for postgres in testing
Some checks failed
Lint / pnpm_install (push) Successful in 1m54s
Test (backend) / e2e (22.11.0) (push) Failing after 2m10s
Publish Docker image / Build (push) Successful in 5m9s
Test (production install and build) / production (22.11.0) (push) Successful in 1m41s
Lint / pnpm_install (pull_request) Successful in 1m27s
Publish Docker image / Build (pull_request) Successful in 4m57s
Test (backend) / e2e (22.11.0) (pull_request) Failing after 2m13s
Test (backend) / unit (22.11.0) (push) Successful in 11m18s
Test (production install and build) / production (22.11.0) (pull_request) Successful in 1m21s
Lint / lint (backend) (push) Successful in 2m24s
Lint / lint (frontend) (push) Successful in 2m17s
Lint / lint (frontend-embed) (push) Successful in 2m13s
Test (backend) / unit (22.11.0) (pull_request) Successful in 10m46s
Lint / lint (frontend-shared) (push) Successful in 2m32s
Lint / lint (misskey-bubble-game) (push) Successful in 2m19s
Lint / lint (misskey-js) (push) Successful in 2m29s
Lint / lint (misskey-reversi) (push) Successful in 2m31s
Lint / typecheck (misskey-js) (push) Successful in 1m22s
Lint / lint (sw) (push) Successful in 2m40s
Lint / typecheck (backend) (push) Successful in 2m21s
Lint / typecheck (sw) (push) Successful in 1m39s
Lint / lint (frontend-shared) (pull_request) Has been cancelled
Lint / lint (misskey-bubble-game) (pull_request) Has been cancelled
Lint / lint (misskey-js) (pull_request) Has been cancelled
Lint / lint (misskey-reversi) (pull_request) Has been cancelled
Lint / lint (sw) (pull_request) Has been cancelled
Lint / typecheck (backend) (pull_request) Has been cancelled
Lint / typecheck (misskey-js) (pull_request) Has been cancelled
Lint / typecheck (sw) (pull_request) Has been cancelled
Lint / lint (backend) (pull_request) Has been cancelled
Lint / lint (frontend-embed) (pull_request) Has been cancelled
Lint / lint (frontend) (pull_request) Has been cancelled

Signed-off-by: eternal-flame-AD <yume@yumechi.jp>
This commit is contained in:
ゆめ 2024-11-17 06:01:25 -06:00
parent 4d44adfaa9
commit bb6056d247
No known key found for this signature in database
3 changed files with 13 additions and 17 deletions

View file

@ -7,11 +7,6 @@ import Redis from 'ioredis';
import { loadConfig } from '../built/config.js'; import { loadConfig } from '../built/config.js';
import { createPostgresDataSource } from '../built/postgres.js'; import { createPostgresDataSource } from '../built/postgres.js';
const timeout = setTimeout(() => {
console.error('Timeout while connecting to databases.');
process.exit(1);
}, 120000);
const config = loadConfig(); const config = loadConfig();
async function connectToPostgres() { async function connectToPostgres() {
@ -59,5 +54,3 @@ const promises = Array
]); ]);
await Promise.allSettled(promises); await Promise.allSettled(promises);
clearTimeout(timeout);

View file

@ -31,15 +31,17 @@ export type UserWebhookDeliverQueue = Bull.Queue<UserWebhookDeliverJobData>;
export type SystemWebhookDeliverQueue = Bull.Queue<SystemWebhookDeliverJobData>; export type SystemWebhookDeliverQueue = Bull.Queue<SystemWebhookDeliverJobData>;
function withMetrics<T>(queue: Bull.Queue<T>): Bull.Queue<T> { function withMetrics<T>(queue: Bull.Queue<T>): Bull.Queue<T> {
setInterval(async () => { if (process.env.NODE_ENV !== 'test') {
mActiveJobs.set({ queue: queue.name }, await queue.getActiveCount()); setInterval(async () => {
mDelayedJobs.set({ queue: queue.name }, await queue.getDelayedCount()); mActiveJobs.set({ queue: queue.name }, await queue.getActiveCount());
mWaitingJobs.set({ queue: queue.name }, await queue.getWaitingCount()); mDelayedJobs.set({ queue: queue.name }, await queue.getDelayedCount());
}, 2000); mWaitingJobs.set({ queue: queue.name }, await queue.getWaitingCount());
}, 2000);
queue.on('waiting', () => { queue.on('waiting', () => {
mJobReceivedCounter.inc({ queue: queue.name }); mJobReceivedCounter.inc({ queue: queue.name });
}); });
}
return queue; return queue;
} }

View file

@ -342,7 +342,8 @@ export function createPostgresDataSource(config: Config, isMain = false) {
}, },
} : false, } : false,
logging: log ? 'all' : ['query'], logging: log ? 'all' : ['query'],
logger: (isMain || log) ? new MyCustomLogger(!log) : undefined, logger: process.env.NODE_ENV === 'test' ? undefined :
(isMain || log) ? new MyCustomLogger(!log) : undefined,
maxQueryExecutionTime: 500, maxQueryExecutionTime: 500,
entities: entities, entities: entities,
migrations: ['../../migration/*.js'], migrations: ['../../migration/*.js'],