Repository: kestra-io/kestra
File: scheduler/src/main/java/io/kestra/scheduler/TriggerEventHandler.java (Java)

Code before:

    /**
     * Handler method for {@link TriggerDeleted}.
     *
     * @param event the event.
     */
    void onTriggerDeleted(TriggerDeleted event) {
        triggerStateStore.find(event.id()).ifPresent(state -> {
            triggerStateStore.delete(event.id());
            maySendExecutionKilled(event, state);
        });
    }

    private void maySendExecutionKilled(TriggerDeleted event, TriggerState state) {
        if (TriggerType.REALTIME.equals(state.getType())) {
            try {
                this.executionKilledQueue.emit(ExecutionKilledTrigger
                    .builder()
                    .tenantId(state.getTenantId())
                    .namespace(state.getNamespace())
                    .flowId(state.getFlowId())
                    .triggerId(state.getTriggerId())
                    .build()
                );
            } catch (QueueException e) {
                Logs.logTrigger(event.id(), Level.WARN, "Cannot kill real-time trigger. Cause: {}", e.getMessage(), e);
            }
        }
    }

    /**
     * Handler method for {@link TriggerCreated}.
     *
     * @param event the event.
     */
    void onTriggerCreated(Clock clock, TriggerCreated event, Integer vNode) {
        Pair<Flow, AbstractTrigger> data = findTrigger(event, event.revision());
        if (data.getRight() != null) {
            TriggerState state = TriggerState
                .of(event.id(), TriggerType.from(data.getRight()), data.getRight().getStopAfter(), data.getRight().isDisabled(), vNode)
                .lastEventId(clock, event.eventId());
            triggerStateStore.save(state);
        }
    }

    private Pair<Flow, AbstractTrigger> findTrigger(TriggerEvent event, Integer revision) {
        FlowWithSource flow = findFlow(event, revision);
        if (flow == null) {
            return Pair.of(null, null);
        }


Review comment (suggestion):
```suggestion
                Logs.logTrigger(event.id(), Level.WARN, "Cannot kill a real-time trigger, it will continue processing until Kestra is restarted. Cause: {}", e.getMessage(), e);
```

Code after:

    /**
     * Handler method for {@link TriggerDeleted}.
     *
     * @param event the event.
     */
    void onTriggerDeleted(TriggerDeleted event) {
        triggerStateStore.find(event.id()).ifPresent(state -> {
            triggerStateStore.delete(event.id());
            maySendExecutionKilled(event, state);
        });
    }

    private void maySendExecutionKilled(TriggerDeleted event, TriggerState state) {
        if (TriggerType.REALTIME.equals(state.getType())) {
            try {
                this.executionKilledQueue.emit(ExecutionKilledTrigger
                    .builder()
                    .tenantId(state.getTenantId())
                    .namespace(state.getNamespace())
                    .flowId(state.getFlowId())
                    .triggerId(state.getTriggerId())
                    .build()
                );
            } catch (QueueException e) {
                Logs.logTrigger(event.id(), Level.WARN, "Cannot kill a real-time trigger, it will continue processing until Kestra is restarted. Cause: {}", e.getMessage(), e);
            }
        }
    }

    /**
     * Handler method for {@link TriggerCreated}.
     *
     * @param event the event.
     */
    void onTriggerCreated(Clock clock, TriggerCreated event, Integer vNode) {
        Pair<Flow, AbstractTrigger> data = findTrigger(event, event.revision());
        if (data.getRight() != null) {
            TriggerState state = TriggerState
                .of(event.id(), TriggerType.from(data.getRight()), data.getRight().getStopAfter(), data.getRight().isDisabled(), vNode)
                .lastEventId(clock, event.eventId());
            triggerStateStore.save(state);
        }
    }

    private Pair<Flow, AbstractTrigger> findTrigger(TriggerEvent event, Integer revision) {
        FlowWithSource flow = findFlow(event, revision);
        if (flow == null) {
            return Pair.of(null, null);
        }