1
0
mirror of https://github.com/misskey-dev/misskey.git synced 2026-05-05 00:45:50 +02:00
Files
misskey/packages/backend/scripts/check_connect.js
かっこかり 37bfcb604f enhance(backend): bundle backend using Rolldown (#17068)
* enhance(backend): bundle backend using rolldown

* fix

* fix [ci skip]

* remove unused build script

* fix

* enhance: 起動からlistenまでかかる時間を減らす (MisskeyIO#1410)

* ✌️

* fix

* update rolldown

* fix(backend): extract static error classes to avoid rolldown design:paramtypes omission

* update rolldown

* Revert "fix(backend): extract static error classes to avoid rolldown design:paramtypes omission"

This reverts commit e2243c9dc3.

* fix

* perf: avoid generating sourcemap in production

* fix

* fix

* fix

* fix paths

* fix

* fix

* fix

* fix

* fix

* enhance: バックエンドの開発サーバー制御をrolldown側で行うように

* remove nodemon

* Update Changelog

* tweak config

* fix

* fix

* fix

* clean up

---------

Co-authored-by: あわわわとーにゅ <17376330+u1-liquid@users.noreply.github.com>
Co-authored-by: bab <mashirohira@gmail.com>
2026-04-16 12:44:50 +09:00

53 lines
1.1 KiB
JavaScript

/*
* SPDX-FileCopyrightText: syuilo and misskey-project
* SPDX-License-Identifier: AGPL-3.0-only
*/
import Redis from 'ioredis';
import { loadConfig } from '../built/config.js';
import { createPostgresDataSource } from '../built/postgres.js';
const config = loadConfig();
async function connectToPostgres() {
const source = createPostgresDataSource(config);
await source.initialize();
await source.destroy();
}
async function connectToRedis(redisOptions) {
let redis;
try {
redis = new Redis({
...redisOptions,
lazyConnect: true,
reconnectOnError: false,
showFriendlyErrorStack: true,
});
await Promise.race([
new Promise((_, reject) => redis.on('error', e => reject(e))),
redis.connect(),
]);
} finally {
redis.disconnect(false);
}
}
// If not all of these are defined, the default one gets reused.
// so we use a Set to only try connecting once to each **uniq** redis.
const promises = Array
.from(new Set([
config.redis,
config.redisForPubsub,
config.redisForJobQueue,
config.redisForTimelines,
config.redisForReactions,
]))
.map(connectToRedis)
.concat([
connectToPostgres(),
]);
await Promise.all(promises);