don't log metrics for postgres in testing
Some checks failed
Lint / lint (frontend-embed) (push) Blocked by required conditions
Lint / lint (frontend-shared) (push) Blocked by required conditions
Lint / lint (misskey-bubble-game) (push) Blocked by required conditions
Lint / lint (misskey-js) (push) Blocked by required conditions
Lint / lint (misskey-reversi) (push) Blocked by required conditions
Lint / lint (sw) (push) Blocked by required conditions
Lint / typecheck (backend) (push) Blocked by required conditions
Lint / typecheck (misskey-js) (push) Blocked by required conditions
Lint / typecheck (sw) (push) Blocked by required conditions
Lint / pnpm_install (push) Successful in 1m55s
Test (backend) / e2e (22.11.0) (push) Failing after 2m2s
Publish Docker image / Build (push) Successful in 4m58s
Test (production install and build) / production (22.11.0) (push) Successful in 1m43s
Lint / pnpm_install (pull_request) Successful in 1m19s
Publish Docker image / Build (pull_request) Successful in 4m49s
Test (backend) / unit (22.11.0) (push) Successful in 10m6s
Test (backend) / e2e (22.11.0) (pull_request) Failing after 2m12s
Test (production install and build) / production (22.11.0) (pull_request) Successful in 1m24s
Lint / lint (frontend) (push) Has been cancelled
Lint / lint (backend) (push) Has been cancelled
Test (backend) / unit (22.11.0) (pull_request) Has been cancelled
Lint / lint (backend) (pull_request) Has been cancelled
Lint / lint (frontend) (pull_request) Has been cancelled
Lint / lint (frontend-embed) (pull_request) Has been cancelled
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

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 9856497c73
No known key found for this signature in database
5 changed files with 23 additions and 22 deletions

View file

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

View file

@ -43,6 +43,12 @@ mBuildInfo.set({
node_version: process.version
}, 1);
const mStartupTime = new prom.Gauge({
name: 'misskey_startup_time',
help: 'Misskey startup time',
labelNames: ['pid']
});
function greet() {
if (!envOption.quiet) {
//#region Misskey logo
@ -112,6 +118,8 @@ export async function masterMain() {
});
}
mStartupTime.set({ pid: process.pid }, Date.now());
if (envOption.disableClustering) {
if (envOption.onlyServer) {
await server();

View file

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

View file

@ -342,7 +342,8 @@ export function createPostgresDataSource(config: Config, isMain = false) {
},
} : false,
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,
entities: entities,
migrations: ['../../migration/*.js'],

View file

@ -5,7 +5,6 @@ import { NestFactory } from '@nestjs/core';
import { MainModule } from '@/MainModule.js';
import { ServerService } from '@/server/ServerService.js';
import { loadConfig } from '@/config.js';
import { NestLogger } from '@/NestLogger.js';
import { INestApplicationContext } from '@nestjs/common';
const config = loadConfig();
@ -22,10 +21,8 @@ let serverService: ServerService;
async function launch() {
await killTestServer();
console.log('starting application...');
app = await NestFactory.createApplicationContext(MainModule, {
logger: new NestLogger(),
logger: ["debug", "log", "error", "warn", "verbose"],
});
serverService = app.get(ServerService);
await serverService.launch();
@ -84,7 +81,7 @@ async function startControllerEndpoints(port = config.port + 1000) {
console.log('starting application...');
app = await NestFactory.createApplicationContext(MainModule, {
logger: new NestLogger(),
logger: ["debug", "log", "error", "warn", "verbose"],
});
serverService = app.get(ServerService);
await serverService.launch();