Skip to content

Commit

Permalink
fix(core): fix checks for wasm in db operations (#28676)
Browse files Browse the repository at this point in the history
  • Loading branch information
Cammisuli authored and jaysoo committed Oct 31, 2024
1 parent 2634804 commit 5049e27
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
3 changes: 2 additions & 1 deletion packages/nx/src/tasks-runner/cache.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import { mkdir, readFile, writeFile } from 'node:fs/promises';
import { cacheDir } from '../utils/cache-directory';
import { Task } from '../config/task-graph';
import { machineId } from 'node-machine-id';
import { NxCache, CachedResult as NativeCacheResult } from '../native';
import { NxCache, CachedResult as NativeCacheResult, IS_WASM } from '../native';
import { getDbConnection } from '../utils/db-connection';
import { isNxCloudUsed } from '../utils/nx-cloud-utils';
import { NxJsonConfiguration, readNxJson } from '../config/nx-json';
Expand All @@ -31,6 +31,7 @@ export type TaskWithCachedResult = { task: Task; cachedResult: CachedResult };

export function dbCacheEnabled(nxJson: NxJsonConfiguration = readNxJson()) {
return (
!IS_WASM &&
process.env.NX_DISABLE_DB !== 'true' &&
nxJson.useLegacyCache !== true &&
process.env.NX_DB_CACHE !== 'false'
Expand Down
4 changes: 2 additions & 2 deletions packages/nx/src/utils/task-history.ts
Original file line number Diff line number Diff line change
Expand Up @@ -39,10 +39,10 @@ let taskHistory: TaskHistory;

/**
* This function returns the singleton instance of TaskHistory
* @returns singleton instance of TaskHistory, null if database is disabled or WASM is not enabled
* @returns singleton instance of TaskHistory, null if database is disabled or WASM is enabled
*/
export function getTaskHistory(): TaskHistory | null {
if (process.env.NX_DISABLE_DB === 'true' || !IS_WASM) {
if (process.env.NX_DISABLE_DB === 'true' || IS_WASM) {
return null;
}

Expand Down

0 comments on commit 5049e27

Please sign in to comment.