diff --git a/packages/nx/src/tasks-runner/cache.ts b/packages/nx/src/tasks-runner/cache.ts index 3416e555b817b..33882bcb210d9 100644 --- a/packages/nx/src/tasks-runner/cache.ts +++ b/packages/nx/src/tasks-runner/cache.ts @@ -29,17 +29,14 @@ export type CachedResult = { }; export type TaskWithCachedResult = { task: Task; cachedResult: CachedResult }; -export function getCache( - nxJson: NxJsonConfiguration, - options: DefaultTasksRunnerOptions -): DbCache | Cache { +// Do not change the order of these arguments as this function is used by nx cloud +export function getCache(options: DefaultTasksRunnerOptions): DbCache | Cache { + const nxJson = readNxJson(); return process.env.NX_DISABLE_DB !== 'true' && (nxJson.enableDbCache === true || process.env.NX_DB_CACHE === 'true') ? new DbCache({ // Remove this in Nx 21 - nxCloudRemoteCache: isNxCloudUsed(readNxJson()) - ? options.remoteCache - : null, + nxCloudRemoteCache: isNxCloudUsed(nxJson) ? options.remoteCache : null, }) : new Cache(options); } diff --git a/packages/nx/src/tasks-runner/task-orchestrator.ts b/packages/nx/src/tasks-runner/task-orchestrator.ts index 9910009cc086a..76b1114590ab0 100644 --- a/packages/nx/src/tasks-runner/task-orchestrator.ts +++ b/packages/nx/src/tasks-runner/task-orchestrator.ts @@ -36,7 +36,7 @@ import type { TaskDetails } from '../native'; export class TaskOrchestrator { private taskDetails: TaskDetails | null = getTaskDetails(); - private cache: DbCache | Cache = getCache(this.nxJson, this.options); + private cache: DbCache | Cache = getCache(this.options); private forkedProcessTaskRunner = new ForkedProcessTaskRunner(this.options); private tasksSchedule = new TasksSchedule(