Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(core): do not check cache validity when putting into the cache #28004

Merged
merged 1 commit into from
Sep 19, 2024
Merged
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
11 changes: 7 additions & 4 deletions packages/nx/src/tasks-runner/cache.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ import { readNxJson } from '../config/nx-json';
import { verifyOrUpdateNxCloudClient } from '../nx-cloud/update-manager';
import { getCloudOptions } from '../nx-cloud/utilities/get-cloud-options';
import { isCI } from '../utils/is-ci';
import { output } from '../utils/output';

export type CachedResult = {
terminalOutput: string;
Expand Down Expand Up @@ -97,7 +98,6 @@ export class DbCache {
outputs: string[],
code: number
) {
await this.assertCacheIsValid();
return tryAndRetry(async () => {
this.cache.put(task.hash, terminalOutput, outputs, code);

Expand Down Expand Up @@ -191,13 +191,16 @@ export class DbCache {
// custom directory, and check if the entries are there when the main db
// cache misses.
if (isCI() && !this.cache.checkCacheFsInSync()) {
const warning = [
const warningLines = [
`Nx found unrecognized artifacts in the cache directory and will not be able to use them.`,
`Nx can only restore artifacts it has metadata about.`,
`Read about this warning and how to address it here: https://nx.dev/troubleshooting/unknown-local-cache`,
``,
].join('\n');
console.warn(warning);
];
output.warn({
title: 'Unrecognized Cache Artifacts',
bodyLines: warningLines,
});
}
}
}
Expand Down