Skip to content

Commit d90da7a

Browse files
authored
fix(replication): allow disabling of task run payload inserts via env var (#2626)
1 parent 2affe54 commit d90da7a

File tree

3 files changed

+6
-1
lines changed

3 files changed

+6
-1
lines changed

apps/webapp/app/env.server.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1102,6 +1102,7 @@ const EnvironmentSchema = z
11021102
RUN_REPLICATION_INSERT_BASE_DELAY_MS: z.coerce.number().int().default(100),
11031103
RUN_REPLICATION_INSERT_MAX_DELAY_MS: z.coerce.number().int().default(2000),
11041104
RUN_REPLICATION_INSERT_STRATEGY: z.enum(["insert", "insert_async"]).default("insert"),
1105+
RUN_REPLICATION_DISABLE_PAYLOAD_INSERT: z.string().default("0"),
11051106

11061107
// Clickhouse
11071108
CLICKHOUSE_URL: z.string(),

apps/webapp/app/services/runsReplicationInstance.server.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,7 @@ function initializeRunsReplicationInstance() {
6666
insertBaseDelayMs: env.RUN_REPLICATION_INSERT_BASE_DELAY_MS,
6767
insertMaxDelayMs: env.RUN_REPLICATION_INSERT_MAX_DELAY_MS,
6868
insertStrategy: env.RUN_REPLICATION_INSERT_STRATEGY,
69+
disablePayloadInsert: env.RUN_REPLICATION_DISABLE_PAYLOAD_INSERT === "1",
6970
});
7071

7172
if (env.RUN_REPLICATION_ENABLED === "1") {

apps/webapp/app/services/runsReplicationService.server.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,7 @@ export type RunsReplicationServiceOptions = {
5757
insertMaxRetries?: number;
5858
insertBaseDelayMs?: number;
5959
insertMaxDelayMs?: number;
60+
disablePayloadInsert?: boolean;
6061
};
6162

6263
type PostgresTaskRun = TaskRun & { masterQueue: string };
@@ -100,6 +101,7 @@ export class RunsReplicationService {
100101
private _insertBaseDelayMs: number;
101102
private _insertMaxDelayMs: number;
102103
private _insertStrategy: "insert" | "insert_async";
104+
private _disablePayloadInsert: boolean;
103105

104106
public readonly events: EventEmitter<RunsReplicationServiceEvents>;
105107

@@ -112,6 +114,7 @@ export class RunsReplicationService {
112114
this._acknowledgeTimeoutMs = options.acknowledgeTimeoutMs ?? 1_000;
113115

114116
this._insertStrategy = options.insertStrategy ?? "insert";
117+
this._disablePayloadInsert = options.disablePayloadInsert ?? false;
115118

116119
this._replicationClient = new LogicalReplicationClient({
117120
pgConfig: {
@@ -750,7 +753,7 @@ export class RunsReplicationService {
750753
};
751754
}
752755

753-
if (event === "update" || event === "delete") {
756+
if (event === "update" || event === "delete" || this._disablePayloadInsert) {
754757
const taskRunInsert = await this.#prepareTaskRunInsert(
755758
run,
756759
run.organizationId,

0 commit comments

Comments
 (0)