File tree Expand file tree Collapse file tree 4 files changed +13
-4
lines changed Expand file tree Collapse file tree 4 files changed +13
-4
lines changed Original file line number Diff line number Diff line change @@ -754,8 +754,8 @@ const EnvironmentSchema = z
754754 /** The max number of runs per API call that we'll dequeue in DEV */
755755 DEV_DEQUEUE_MAX_RUNS_PER_PULL : z . coerce . number ( ) . int ( ) . default ( 10 ) ,
756756
757- /** The maximum concurrent local run processes executing at once in dev */
758- DEV_MAX_CONCURRENT_RUNS : z . coerce . number ( ) . int ( ) . default ( 25 ) ,
757+ /** The maximum concurrent local run processes executing at once in dev. This is a hard limit */
758+ DEV_MAX_CONCURRENT_RUNS : z . coerce . number ( ) . int ( ) . optional ( ) ,
759759
760760 /** The CLI should connect to this for dev runs */
761761 DEV_ENGINE_URL : z . string ( ) . default ( process . env . APP_ORIGIN ?? "http://localhost:3030" ) ,
@@ -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 ( ) ,
Original file line number Diff line number Diff line change @@ -20,7 +20,11 @@ export const loader = createLoaderApiRoute(
2020 environmentId : authentication . environment . id ,
2121 dequeueIntervalWithRun : env . DEV_DEQUEUE_INTERVAL_WITH_RUN ,
2222 dequeueIntervalWithoutRun : env . DEV_DEQUEUE_INTERVAL_WITHOUT_RUN ,
23- maxConcurrentRuns : env . DEV_MAX_CONCURRENT_RUNS ,
23+ // Limit max runs to smaller of an optional global limit and the environment limit
24+ maxConcurrentRuns : Math . min (
25+ env . DEV_MAX_CONCURRENT_RUNS ?? authentication . environment . maximumConcurrencyLimit ,
26+ authentication . environment . maximumConcurrencyLimit
27+ ) ,
2428 engineUrl : env . DEV_ENGINE_URL ,
2529 } ) ;
2630 } catch ( error ) {
Original file line number Diff line number Diff 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" ) {
Original file line number Diff line number Diff line change @@ -57,6 +57,7 @@ export type RunsReplicationServiceOptions = {
5757 insertMaxRetries ?: number ;
5858 insertBaseDelayMs ?: number ;
5959 insertMaxDelayMs ?: number ;
60+ disablePayloadInsert ?: boolean ;
6061} ;
6162
6263type 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 ,
You can’t perform that action at this time.
0 commit comments