Worker fixes (#10562)

Signed-off-by: Denis Bykhov <bykhov.denis@gmail.com>
This commit is contained in:
Denis Bykhov
2026-02-26 14:46:09 +05:00
committed by GitHub
parent c68076ea10
commit 93bce6207b
4 changed files with 7 additions and 5 deletions
+3 -2
View File
@@ -65,6 +65,7 @@ import { getContextValue } from '@hcengineering/server-process-resources'
import { createCollaboratorClient } from './collaborator'
import { isError } from './errors'
import { getClient, releaseClient, SERVICE_NAME } from './utils'
import config from './config'
const activeExecutions = new Set<Ref<Execution>>()
@@ -634,7 +635,7 @@ async function setNextTimers (control: ProcessControl, execution: Execution): Pr
async function cleanTimers (control: ProcessControl, execution: Execution): Promise<void> {
try {
const queue = getPlatformQueue(SERVICE_NAME)
const queue = getPlatformQueue(SERVICE_NAME, config.QueueRegion)
const producer = queue.getProducer<TimeMachineMessage>(control.ctx, QueueTopic.TimeMachine)
await producer.send(control.ctx, control.workspace, [
{
@@ -652,7 +653,7 @@ async function setTimer (control: ProcessControl, execution: Execution, transiti
const targetDate: number = filled.value
if (targetDate === undefined || typeof targetDate !== 'number' || targetDate === 0 || Number.isNaN(targetDate)) return
try {
const queue = getPlatformQueue(SERVICE_NAME)
const queue = getPlatformQueue(SERVICE_NAME, config.QueueRegion)
const producer = queue.getProducer<TimeMachineMessage>(control.ctx, QueueTopic.TimeMachine)
const data: ProcessMessage = {
+2 -1
View File
@@ -1,5 +1,6 @@
import { MeasureMetricsContext, type WorkspaceUuid } from '@hcengineering/core'
import { getPlatformQueue } from '@hcengineering/kafka'
import config from './config'
export async function SendTimeEvent (
ctx: MeasureMetricsContext,
@@ -8,7 +9,7 @@ export async function SendTimeEvent (
data: any
): Promise<void> {
const SERVICE_NAME = 'time-machine'
const queue = getPlatformQueue(SERVICE_NAME)
const queue = getPlatformQueue(SERVICE_NAME, config.QueueRegion)
const producer = queue.getProducer<any>(ctx, topic as any)
+1 -1
View File
@@ -26,7 +26,7 @@ export async function runWorker (): Promise<void> {
const db = await TimeMachineDB.init(config.DbUrl)
const ctx = new MeasureMetricsContext(SERVICE_NAME, {})
const queue = getPlatformQueue(SERVICE_NAME)
const queue = getPlatformQueue(SERVICE_NAME, config.QueueRegion)
// 1. Kafka Consumer for commands
queue.createConsumer<TimeMachineMessage>(ctx, QueueTopic.TimeMachine, SERVICE_NAME, async (ctx, msg) => {