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

Use create_new instead of atomic-file-write #2914

Merged
merged 5 commits into from
Feb 24, 2024

Conversation

mattfbacon
Copy link
Contributor

This provides the same functionality but without temporary files, platform-specific code, fragility of O_TMPFILE support, and an extra dependency.

This provides the same functionality but without temporary files, platform-specific code, fragility of `O_TMPFILE` support, and an extra dependency.
Copy link
Collaborator

@abonander abonander left a comment

Choose a reason for hiding this comment

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

Unfortunately this implementation is more fragile than the one it replaces, as it does not consider race conditions, or even what happens on the first run before the file exists.

If two crates in the workspace have the same query, they'll fight over each other trying to delete and then re-create the file if Cargo decides to compile them concurrently.

sqlx-macros-core/src/query/data.rs Outdated Show resolved Hide resolved
sqlx-macros-core/src/query/data.rs Show resolved Hide resolved
@mattfbacon
Copy link
Contributor Author

Good points, I forgot to explicitly handle these conditions as non-errors. I think the latest commit should handle these properly.

Copy link
Contributor

@jplatte jplatte left a comment

Choose a reason for hiding this comment

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

I'm still not convinced that avoiding the dependency is worth it, but I guess there's nothing obviously wrong with it anymore. Could work 😅

Copy link
Collaborator

@abonander abonander left a comment

Choose a reason for hiding this comment

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

LGTM, just needs to handle PermissionDenied as discussed above.

@mattfbacon
Copy link
Contributor Author

OK

@abonander abonander merged commit b615d2a into launchbadge:main Feb 24, 2024
64 checks passed
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.

3 participants