mirror of
https://github.com/Abdulazizzn/n8n-enterprise-unlocked.git
synced 2025-12-18 10:31:15 +00:00
refactor(core): Implement a new OnPubSubEvent decorator (#15688)
This commit is contained in:
committed by
GitHub
parent
b772462cea
commit
4b11268a6e
@@ -1,7 +1,7 @@
|
||||
import type { PushMessage } from '@n8n/api-types';
|
||||
import { inProduction, Logger } from '@n8n/backend-common';
|
||||
import type { User } from '@n8n/db';
|
||||
import { OnShutdown } from '@n8n/decorators';
|
||||
import { OnPubSubEvent, OnShutdown } from '@n8n/decorators';
|
||||
import { Container, Service } from '@n8n/di';
|
||||
import type { Application } from 'express';
|
||||
import { ServerResponse } from 'http';
|
||||
@@ -205,6 +205,12 @@ export class Push extends TypedEmitter<PushEvents> {
|
||||
return isWorker || (isMultiMain && !this.hasPushRef(pushRef));
|
||||
}
|
||||
|
||||
@OnPubSubEvent('relay-execution-lifecycle-event', { instanceType: 'main' })
|
||||
handleRelayExecutionLifecycleEvent({ pushRef, ...pushMsg }: PushMessage & { pushRef: string }) {
|
||||
if (!this.hasPushRef(pushRef)) return;
|
||||
this.send(pushMsg, pushRef);
|
||||
}
|
||||
|
||||
/**
|
||||
* Relay a push message via the `n8n.commands` pubsub channel,
|
||||
* reducing the payload size if too large.
|
||||
|
||||
Reference in New Issue
Block a user