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

Avoid failing if file is quickly created and deleted #3105

Merged

Conversation

vinistock
Copy link
Member

@vinistock vinistock commented Jan 28, 2025

Motivation

I noticed that we were crashing if a file was quickly created and deleted. Before we got to processing the created notification, the file would already no longer be there and trying to read from disk would raise.

This can happen when running tests that automatically created/delete files or if switching branches quickly.

Implementation

Just started rescuing Errno::ENOENT. If the file is no longer there, it probably means we just haven't processed its deleted notification.

Automated Tests

Added a test that fails before the fix.

Copy link
Member Author


How to use the Graphite Merge Queue

Add the label graphite-merge to this PR to add it to the merge queue.

You must have a Graphite account in order to use the merge queue. Sign up using this link.

An organization admin has enabled the Graphite Merge Queue in this repository.

Please do not merge from GitHub as this will restart CI on PRs being processed by the merge queue.

This stack of pull requests is managed by Graphite. Learn more about stacking.

@vinistock vinistock self-assigned this Jan 28, 2025
@vinistock vinistock added bugfix This PR will fix an existing bug server This pull request should be included in the server gem's release notes labels Jan 28, 2025 — with Graphite App
@vinistock vinistock marked this pull request as ready for review January 28, 2025 22:24
@vinistock vinistock requested a review from a team as a code owner January 28, 2025 22:24
@vinistock vinistock force-pushed the 01-28-avoid_failing_if_file_is_quickly_created_and_deleted branch from cbce038 to 85a145c Compare January 28, 2025 22:32
@vinistock vinistock added the graphite-merge Ship this PR using Graphite's merge queue label Jan 29, 2025
Copy link
Member Author

vinistock commented Jan 29, 2025

Merge activity

  • Jan 29, 8:25 AM EST: The merge label 'graphite-merge' was detected. This PR will be added to the Graphite merge queue once it meets the requirements.
  • Jan 29, 8:32 AM EST: A user added this pull request to the Graphite merge queue.
  • Jan 29, 8:58 AM EST: The Graphite merge queue couldn't merge this PR because it failed for an unknown reason.
  • Jan 29, 8:58 AM EST: The merge label 'graphite-merge' was detected. This PR will be added to the Graphite merge queue once it meets the requirements.
  • Jan 29, 1:58 PM UTC: The merge label 'graphite-merge' was removed. This PR will no longer be merged by the Graphite merge queue
  • Jan 29, 9:11 AM EST: The merge label 'graphite-merge' was detected. This PR will be added to the Graphite merge queue once it meets the requirements.
  • Jan 29, 9:13 AM EST: A user added this pull request to the Graphite merge queue.

### Motivation

I noticed that we were crashing if a file was quickly created and deleted. Before we got to processing the created notification, the file would already no longer be there and trying to read from disk would raise.

This can happen when running tests that automatically created/delete files or if switching branches quickly.

### Implementation

Just started rescuing `Errno::ENOENT`. If the file is no longer there, it probably means we just haven't processed its deleted notification.

### Automated Tests

Added a test that fails before the fix.
@vinistock vinistock force-pushed the 01-28-avoid_failing_if_file_is_quickly_created_and_deleted branch from 85a145c to 9f0f8f2 Compare January 29, 2025 13:32
@graphite-app graphite-app bot removed the graphite-merge Ship this PR using Graphite's merge queue label Jan 29, 2025
@vinistock vinistock added the graphite-merge Ship this PR using Graphite's merge queue label Jan 29, 2025
@graphite-app graphite-app bot merged commit 9f0f8f2 into main Jan 29, 2025
45 checks passed
@graphite-app graphite-app bot deleted the 01-28-avoid_failing_if_file_is_quickly_created_and_deleted branch January 29, 2025 14:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bugfix This PR will fix an existing bug graphite-merge Ship this PR using Graphite's merge queue server This pull request should be included in the server gem's release notes
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants