Merge branch 'main' into graphile-upgrade
🚀 Publish Trigger.dev Docker / units (push) Failing after 10m48s
🚀 Publish Trigger.dev Docker / typecheck (push) Failing after 10m48s
🚀 Publish Trigger.dev Docker / publish (push) Has been skipped

This commit is contained in:
nicktrn
2024-05-10 17:15:24 +01:00
3 changed files with 23 additions and 0 deletions
@@ -60,6 +60,11 @@ export class IngestSendEvent {
try {
const deliverAt = this.#calculateDeliverAt(options);
if (!environment.organization.runsEnabled) {
logger.debug("IngestSendEvent: Runs are disabled for this organization", environment);
return;
}
return await $transaction(this.#prismaClient, async (tx) => {
const externalAccount = options?.accountId
? await tx.externalAccount.upsert({
@@ -8,6 +8,7 @@ import { $transaction, prisma } from "~/db.server";
import { workerQueue } from "../worker.server";
import { ResumeRunService } from "./resumeRun.server";
import { createHash } from "node:crypto";
import { logger } from "../logger.server";
type FoundRun = NonNullable<Awaited<ReturnType<typeof findRun>>>;
type RunConnectionsByKey = Awaited<ReturnType<typeof createRunConnections>>;
@@ -36,6 +37,13 @@ export class StartRunService {
}
#runIsStartable(run: FoundRun) {
if (!run.organization.runsEnabled) {
logger.debug("StartRunService: Runs are disabled for this organization", {
organizationId: run.organization.id,
});
return false;
}
const startableStatuses = ["PENDING", "WAITING_ON_CONNECTIONS"] as const;
return startableStatuses.includes(run.status);
}
@@ -144,6 +152,7 @@ async function findRun(tx: PrismaClientOrTransaction, id: string) {
include: {
queue: true,
environment: true,
organization: true,
version: {
include: {
integrations: {
@@ -4,6 +4,7 @@ import { workerQueue } from "../worker.server";
import { requestUrl } from "~/utils/requestUrl.server";
import { RuntimeEnvironmentType } from "@trigger.dev/database";
import { createHttpSourceRequest } from "~/utils/createHttpSourceRequest";
import { logger } from "../logger.server";
export class HandleHttpSourceService {
#prismaClient: PrismaClient;
@@ -19,6 +20,7 @@ export class HandleHttpSourceService {
endpoint: true,
environment: true,
secretReference: true,
organization: true,
},
});
@@ -30,6 +32,13 @@ export class HandleHttpSourceService {
return { status: 200 };
}
if (!triggerSource.organization.runsEnabled) {
logger.debug("HandleHttpSourceService: Runs are disabled for this organization", {
organizationId: triggerSource.organization.id,
});
return { status: 404 };
}
if (!triggerSource.interactive) {
const sourceRequest = await createHttpSourceRequest(request);