mirror of
https://activitypub.software/TransFem-org/Sharkey.git
synced 2024-12-29 18:09:05 +01:00
merge: Revert "Synchronize server startup" (!831)
View MR for information: https://activitypub.software/TransFem-org/Sharkey/-/merge_requests/831 Approved-by: dakkar <dakkar@thenautilus.net> Approved-by: Charlotte <timo.herngreen@gmail.com>
This commit is contained in:
commit
5eca807e19
3 changed files with 13 additions and 14 deletions
|
@ -19,18 +19,17 @@ export async function server() {
|
||||||
logger: new NestLogger(),
|
logger: new NestLogger(),
|
||||||
});
|
});
|
||||||
|
|
||||||
if (process.env.NODE_ENV !== 'test') {
|
|
||||||
await app.get(ChartManagementService).start();
|
|
||||||
}
|
|
||||||
if (!envOption.noDaemons) {
|
|
||||||
await app.get(QueueStatsService).start();
|
|
||||||
await app.get(ServerStatsService).start();
|
|
||||||
}
|
|
||||||
|
|
||||||
// Start server last so the other services can register hooks first
|
|
||||||
const serverService = app.get(ServerService);
|
const serverService = app.get(ServerService);
|
||||||
await serverService.launch();
|
await serverService.launch();
|
||||||
|
|
||||||
|
if (process.env.NODE_ENV !== 'test') {
|
||||||
|
app.get(ChartManagementService).start();
|
||||||
|
}
|
||||||
|
if (!envOption.noDaemons) {
|
||||||
|
app.get(QueueStatsService).start();
|
||||||
|
app.get(ServerStatsService).start();
|
||||||
|
}
|
||||||
|
|
||||||
return app;
|
return app;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -39,8 +38,8 @@ export async function jobQueue() {
|
||||||
logger: new NestLogger(),
|
logger: new NestLogger(),
|
||||||
});
|
});
|
||||||
|
|
||||||
await jobQueue.get(QueueProcessorService).start();
|
jobQueue.get(QueueProcessorService).start();
|
||||||
await jobQueue.get(ChartManagementService).start();
|
jobQueue.get(ChartManagementService).start();
|
||||||
|
|
||||||
return jobQueue;
|
return jobQueue;
|
||||||
}
|
}
|
||||||
|
|
|
@ -33,7 +33,7 @@ export class QueueStatsService implements OnApplicationShutdown {
|
||||||
* Report queue stats regularly
|
* Report queue stats regularly
|
||||||
*/
|
*/
|
||||||
@bindThis
|
@bindThis
|
||||||
public async start(): Promise<void> {
|
public start(): void {
|
||||||
const log = [] as any[];
|
const log = [] as any[];
|
||||||
|
|
||||||
ev.on('requestQueueStatsLog', x => {
|
ev.on('requestQueueStatsLog', x => {
|
||||||
|
@ -82,7 +82,7 @@ export class QueueStatsService implements OnApplicationShutdown {
|
||||||
activeInboxJobs = 0;
|
activeInboxJobs = 0;
|
||||||
};
|
};
|
||||||
|
|
||||||
await tick();
|
tick();
|
||||||
|
|
||||||
this.intervalId = setInterval(tick, interval);
|
this.intervalId = setInterval(tick, interval);
|
||||||
}
|
}
|
||||||
|
|
|
@ -68,7 +68,7 @@ export class ServerStatsService implements OnApplicationShutdown {
|
||||||
if (log.length > 200) log.pop();
|
if (log.length > 200) log.pop();
|
||||||
};
|
};
|
||||||
|
|
||||||
await tick();
|
tick();
|
||||||
|
|
||||||
this.intervalId = setInterval(tick, interval);
|
this.intervalId = setInterval(tick, interval);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue