Skip to content

Commit 8de7ef5

Browse files
committed
remove additional billing check from hot path
1 parent cb71249 commit 8de7ef5

2 files changed

Lines changed: 3 additions & 25 deletions

File tree

internal-packages/run-engine/src/engine/index.ts

Lines changed: 2 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -364,6 +364,7 @@ export class RunEngine {
364364
scheduleInstanceId,
365365
createdAt,
366366
bulkActionId,
367+
planType,
367368
}: TriggerParams,
368369
tx?: PrismaClientOrTransaction
369370
): Promise<TaskRun> {
@@ -374,37 +375,13 @@ export class RunEngine {
374375
"trigger",
375376
async (span) => {
376377
const status = delayUntil ? "DELAYED" : "PENDING";
377-
const runId = RunId.fromFriendlyId(friendlyId);
378-
379-
// Get billing information to store with the run
380-
let planType: string | undefined;
381-
const currentPlan = await this.billingCache.getCurrentPlan(environment.organization.id);
382-
383-
if (currentPlan.err || !currentPlan.val) {
384-
// If billing lookup fails, don't block the trigger - planType will be undefined
385-
this.logger.warn(
386-
"Failed to get billing info during trigger, proceeding without planType",
387-
{
388-
orgId: environment.organization.id,
389-
runId,
390-
error:
391-
currentPlan.err instanceof Error
392-
? currentPlan.err.message
393-
: String(currentPlan.err),
394-
hasValue: !!currentPlan.val,
395-
}
396-
);
397-
planType = undefined;
398-
} else {
399-
planType = currentPlan.val.type;
400-
}
401378

402379
//create run
403380
let taskRun: TaskRun;
404381
try {
405382
taskRun = await prisma.taskRun.create({
406383
data: {
407-
id: runId,
384+
id: RunId.fromFriendlyId(friendlyId),
408385
engine: "V2",
409386
status,
410387
number,

internal-packages/run-engine/src/engine/types.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -136,6 +136,7 @@ export type TriggerParams = {
136136
scheduleInstanceId?: string;
137137
createdAt?: Date;
138138
bulkActionId?: string;
139+
planType?: string;
139140
};
140141

141142
export type EngineWorker = Worker<typeof workerCatalog>;

0 commit comments

Comments
 (0)