Skip to content

Commit

Permalink
feat(backend): MasterプロセスのPIDを書き出せるように (#11909)
Browse files Browse the repository at this point in the history
  • Loading branch information
CyberRex0 authored Sep 27, 2023
1 parent 2039e24 commit 5ad0906
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 11 deletions.
25 changes: 14 additions & 11 deletions .config/example.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ url: https://example.tld/
# The port that your Misskey server should listen on.
port: 3000

# You can also use UNIX domain socket.
# You can also use UNIX domain socket.
# socket: /path/to/misskey.sock
# chmodSocket: '777'

Expand Down Expand Up @@ -60,17 +60,17 @@ dbReplications: false
# You can configure any number of replicas here
#dbSlaves:
# -
# host:
# port:
# db:
# user:
# pass:
# host:
# port:
# db:
# user:
# pass:
# -
# host:
# port:
# db:
# user:
# pass:
# host:
# port:
# db:
# user:
# pass:

# ┌─────────────────────┐
#───┘ Redis configuration └─────────────────────────────────────
Expand Down Expand Up @@ -206,3 +206,6 @@ signToActivityPubGet: true

# Upload or download file size limits (bytes)
#maxFileSize: 262144000

# PID File of master process
#pidFile: /tmp/misskey.pid
1 change: 1 addition & 0 deletions packages/backend/src/boot/master.ts
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,7 @@ export async function masterMain() {
showNodejsVersion();
config = loadConfigBoot();
//await connectDb();
if (config.pidFile) fs.writeFileSync(config.pidFile, process.pid.toString());
} catch (e) {
bootLogger.error('Fatal error occurred during initialization', null, true);
process.exit(1);
Expand Down
3 changes: 3 additions & 0 deletions packages/backend/src/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,7 @@ type Source = {
perChannelMaxNoteCacheCount?: number;
perUserNotificationsMaxCount?: number;
deactivateAntennaThreshold?: number;
pidFile: string;
};

export type Config = {
Expand Down Expand Up @@ -163,6 +164,7 @@ export type Config = {
perChannelMaxNoteCacheCount: number;
perUserNotificationsMaxCount: number;
deactivateAntennaThreshold: number;
pidFile: string;
};

const _filename = fileURLToPath(import.meta.url);
Expand Down Expand Up @@ -255,6 +257,7 @@ export function loadConfig(): Config {
perChannelMaxNoteCacheCount: config.perChannelMaxNoteCacheCount ?? 1000,
perUserNotificationsMaxCount: config.perUserNotificationsMaxCount ?? 300,
deactivateAntennaThreshold: config.deactivateAntennaThreshold ?? (1000 * 60 * 60 * 24 * 7),
pidFile: config.pidFile,
};
}

Expand Down

0 comments on commit 5ad0906

Please sign in to comment.