From e46d66bf267d7e859f137ea3dd72b205d53f0f6a Mon Sep 17 00:00:00 2001 From: Ralf Kistner Date: Wed, 12 Nov 2025 15:04:19 +0200 Subject: [PATCH 1/2] Fix liveness probe when no connections are defined. --- .../src/replication/ReplicationEngine.ts | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/packages/service-core/src/replication/ReplicationEngine.ts b/packages/service-core/src/replication/ReplicationEngine.ts index 3ae7849d8..9ef584e18 100644 --- a/packages/service-core/src/replication/ReplicationEngine.ts +++ b/packages/service-core/src/replication/ReplicationEngine.ts @@ -1,9 +1,10 @@ -import { logger } from '@powersync/lib-services-framework'; +import { container, logger } from '@powersync/lib-services-framework'; import { AbstractReplicator } from './AbstractReplicator.js'; import { ConnectionTestResult } from './ReplicationModule.js'; export class ReplicationEngine { private readonly replicators: Map = new Map(); + private probeInterval: NodeJS.Timeout | null = null; /** * Register a Replicator with the engine @@ -27,6 +28,17 @@ export class ReplicationEngine { logger.info(`Starting Replicator: ${replicator.id}`); replicator.start(); } + if (this.replicators.size == 0) { + // If a replicator is running, the replicators update the probes. + // If no connections are configured, then no replicator is running + // Typical when no connections are configured. + // In this case, update the probe here to avoid liveness probe failures. + this.probeInterval = setInterval(() => { + container.probes.touch().catch((e) => { + logger.error(`Failed to touch probe`, e); + }); + }, 5_000); + } logger.info('Successfully started Replication Engine.'); } @@ -39,6 +51,9 @@ export class ReplicationEngine { logger.info(`Stopping Replicator: ${replicator.id}`); await replicator.stop(); } + if (this.probeInterval) { + clearInterval(this.probeInterval); + } logger.info('Successfully shut down Replication Engine.'); } From 898c5936186c4af3e25973ad4d9629ef97b43c19 Mon Sep 17 00:00:00 2001 From: Ralf Kistner Date: Wed, 12 Nov 2025 15:04:48 +0200 Subject: [PATCH 2/2] Add changeset. --- .changeset/orange-forks-eat.md | 5 +++++ 1 file changed, 5 insertions(+) create mode 100644 .changeset/orange-forks-eat.md diff --git a/.changeset/orange-forks-eat.md b/.changeset/orange-forks-eat.md new file mode 100644 index 000000000..b25796e37 --- /dev/null +++ b/.changeset/orange-forks-eat.md @@ -0,0 +1,5 @@ +--- +'@powersync/service-core': patch +--- + +Fix liveness probe when no connections are defined.