Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ export class ExecuteTasksWaitingForDeployService extends BaseService {

const maxCount = env.LEGACY_RUN_ENGINE_WAITING_FOR_DEPLOY_BATCH_SIZE;

const runsWaitingForDeploy = await this._prisma.taskRun.findMany({
const runsWaitingForDeploy = await this._replica.taskRun.findMany({
where: {
runtimeEnvironmentId: backgroundWorker.runtimeEnvironmentId,
projectId: backgroundWorker.projectId,
Expand Down
1 change: 1 addition & 0 deletions internal-packages/run-engine/src/engine/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -268,6 +268,7 @@ export class RunEngine {

const resources: SystemResources = {
prisma: this.prisma,
readOnlyPrisma: this.readOnlyPrisma,
worker: this.worker,
eventBus: this.eventBus,
logger: this.logger,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ export class PendingVersionSystem {
queues: backgroundWorker.queues.map((queue) => queue.name),
});

const pendingRuns = await this.$.prisma.taskRun.findMany({
const pendingRuns = await this.$.readOnlyPrisma.taskRun.findMany({
where: {
runtimeEnvironmentId: backgroundWorker.runtimeEnvironmentId,
projectId: backgroundWorker.projectId,
Expand Down
3 changes: 2 additions & 1 deletion internal-packages/run-engine/src/engine/systems/systems.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { Meter, Tracer } from "@internal/tracing";
import { Logger } from "@trigger.dev/core/logger";
import { PrismaClient } from "@trigger.dev/database";
import { PrismaClient, PrismaReplicaClient } from "@trigger.dev/database";
import { RunQueue } from "../../run-queue/index.js";
import { EventBus } from "../eventBus.js";
import { RunLocker } from "../locking.js";
Expand All @@ -9,6 +9,7 @@ import { RaceSimulationSystem } from "./raceSimulationSystem.js";

export type SystemResources = {
prisma: PrismaClient;
readOnlyPrisma: PrismaReplicaClient;
worker: EngineWorker;
eventBus: EventBus;
logger: Logger;
Expand Down