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

Handle invalid clockspec error and log more when loading cache fails #9709

Merged
merged 6 commits into from May 16, 2024

Conversation

Nikola-3
Copy link
Contributor

@Nikola-3 Nikola-3 commented May 9, 2024

↪️ Pull Request

💻 Examples

🚨 Test instructions

✔️ PR Todo

  • Added/updated unit tests for this change
  • Filled out test instructions (In case there aren't any unit tests)
  • Included links to related issues/PRs

packages/core/core/src/RequestTracker.js Show resolved Hide resolved
if (e.message && e.message.includes('invalid clockspec')) {
// Note this assumes only one snapshot file per cache and will potentially break
// if multiple snapshot files exist in the cache directory
const snapshotFile = readdirSync(options.cacheDir).find(file =>
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

you probably want to log something before doing this because it can also fail

packages/core/core/src/RequestTracker.js Outdated Show resolved Hide resolved
},
};
if (snapshotFile != null) {
additionalMessage = readFileSync(
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why do you need to find the snapshot file? isn't it always written to the same location?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's written to snapshot-<hash>.txt but I don't know if the hash persists. I guess I can look through the code and see if the files location is available to be passed to loadRequestGraph

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fair enough ; okay, in that case you could look for snapshot-*.txt rather than any txt file?

if (timeout != null) {
clearTimeout(timeout);
}
let additionalMessage;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

you can extract this to a function but maybe it can be simpler (avoid the guessing snapshot path part & just log more lines rather than assigning to a variable etc.)

@Nikola-3 Nikola-3 changed the title Log more when loading cache fails Handle invalid clockspec error and log more when loading cache fails May 10, 2024
Copy link
Contributor

@yamadapc yamadapc left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

please consider extracting the new logging block into a function

Copy link
Contributor

@mattcompiles mattcompiles left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Love your work 🍻

@Nikola-3 Nikola-3 added this pull request to the merge queue May 16, 2024
Merged via the queue into v2 with commit d58c1ce May 16, 2024
16 of 17 checks passed
@mischnic mischnic deleted the log-more-when-loading-cache-fails branch May 17, 2024 07:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants