feat(core): Unify application components shutdown (#8097)

## Summary

Add `ShutdownService` and `OnShutdown` decorator for more unified way to
shutdown different components. Use this new way in the following
components:

- HTTP(S) server
- Pruning service
- Push connection
- License

---------

Co-authored-by: कारतोफ्फेलस्क्रिप्ट™ <aditya@netroy.in>
This commit is contained in:
Tomi Turtiainen
2023-12-22 12:39:58 +02:00
committed by GitHub
parent c158ca2471
commit 3a881be6c2
15 changed files with 412 additions and 17 deletions

View File

@@ -65,6 +65,7 @@ import { ActivationErrorsService } from '@/ActivationErrors.service';
import { NotFoundError } from './errors/response-errors/not-found.error';
import { ActiveWorkflowsService } from '@/services/activeWorkflows.service';
import { WorkflowStaticDataService } from '@/workflows/workflowStaticData.service';
import { OnShutdown } from '@/decorators/OnShutdown';
interface QueuedActivation {
activationMode: WorkflowActivateMode;
@@ -664,6 +665,7 @@ export class ActiveWorkflowRunner implements IWebhookManager {
await this.addActiveWorkflows('leadershipChange');
}
@OnShutdown()
async removeAllTriggerAndPollerBasedWorkflows() {
await this.activeWorkflows.removeAllTriggerAndPollerBasedWorkflows();
}