fix(core): do not check cache validity when putting into the cache (#28004)
<!-- Please make sure you have read the submission guidelines before posting an PR --> <!-- https://github.com/nrwl/nx/blob/master/CONTRIBUTING.md#-submitting-a-pr --> <!-- Please make sure that your commit message follows our format --> <!-- Example: `fix(nx): must begin with lowercase` --> <!-- If this is a particularly complex change or feature addition, you can request a dedicated Nx release for this pull request branch. Mention someone from the Nx team or the `@nrwl/nx-pipelines-reviewers` and they will confirm if the PR warrants its own release for testing purposes, and generate it for you if appropriate. --> ## Current Behavior <!-- This is the behavior we have today --> Invalid cache message shown twice. ## Expected Behavior <!-- This is the behavior we should expect with the changes in this PR --> Invalid cache message shown once. ## Related Issue(s) <!-- Please link the issue being fixed so it gets closed when this is merged. --> Fixes #
This commit is contained in:
parent
f767bab941
commit
999abe9656
@ -18,6 +18,7 @@ import { readNxJson } from '../config/nx-json';
|
|||||||
import { verifyOrUpdateNxCloudClient } from '../nx-cloud/update-manager';
|
import { verifyOrUpdateNxCloudClient } from '../nx-cloud/update-manager';
|
||||||
import { getCloudOptions } from '../nx-cloud/utilities/get-cloud-options';
|
import { getCloudOptions } from '../nx-cloud/utilities/get-cloud-options';
|
||||||
import { isCI } from '../utils/is-ci';
|
import { isCI } from '../utils/is-ci';
|
||||||
|
import { output } from '../utils/output';
|
||||||
|
|
||||||
export type CachedResult = {
|
export type CachedResult = {
|
||||||
terminalOutput: string;
|
terminalOutput: string;
|
||||||
@ -97,7 +98,6 @@ export class DbCache {
|
|||||||
outputs: string[],
|
outputs: string[],
|
||||||
code: number
|
code: number
|
||||||
) {
|
) {
|
||||||
await this.assertCacheIsValid();
|
|
||||||
return tryAndRetry(async () => {
|
return tryAndRetry(async () => {
|
||||||
this.cache.put(task.hash, terminalOutput, outputs, code);
|
this.cache.put(task.hash, terminalOutput, outputs, code);
|
||||||
|
|
||||||
@ -191,13 +191,16 @@ export class DbCache {
|
|||||||
// custom directory, and check if the entries are there when the main db
|
// custom directory, and check if the entries are there when the main db
|
||||||
// cache misses.
|
// cache misses.
|
||||||
if (isCI() && !this.cache.checkCacheFsInSync()) {
|
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 found unrecognized artifacts in the cache directory and will not be able to use them.`,
|
||||||
`Nx can only restore artifacts it has metadata about.`,
|
`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`,
|
`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,
|
||||||
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user