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

Add mutex lock in repository saves #13

Merged
merged 2 commits into from
Dec 11, 2024
Merged

Conversation

gringolito
Copy link
Owner

@gringolito gringolito commented Dec 11, 2024

Concurrent saves were overwriting due to racing conditions on file reads/writes. To avoid those race conditions a R/W mutex was added into the host.Repository implementation to sequentiate the concurrent writes on the filesystem.

Also, some improvements to the logging system were made to help debug the issue, such as adopting (ordered) UUIDv7 on the RequestId instead of the previously used UUIDv4.

Signed-off-by: Filipe Utzig <filipe@gringolito.com>
Signed-off-by: Filipe Utzig <filipe@gringolito.com>
@gringolito gringolito force-pushed the bugfix/concurrent-file-writes branch from 2d1a1c3 to b9fd3b9 Compare December 11, 2024 17:40
Copy link

codecov bot commented Dec 11, 2024

Codecov Report

Attention: Patch coverage is 84.37500% with 5 lines in your changes missing coverage. Please review.

Project coverage is 71.84%. Comparing base (477fd9e) to head (b9fd3b9).
Report is 1 commits behind head on master.

Files with missing lines Patch % Lines
api/middleware.go 70.00% 2 Missing and 1 partial ⚠️
api/middleware/fiberslog/slog.go 0.00% 2 Missing ⚠️
@@            Coverage Diff             @@
##           master      #13      +/-   ##
==========================================
- Coverage   72.76%   71.84%   -0.92%     
==========================================
  Files          20       20              
  Lines         804      984     +180     
==========================================
+ Hits          585      707     +122     
- Misses        206      263      +57     
- Partials       13       14       +1     
Files with missing lines Coverage Δ
pkg/host/repository.go 97.70% <100.00%> (+0.83%) ⬆️
api/middleware/fiberslog/slog.go 0.00% <0.00%> (ø)
api/middleware.go 69.23% <70.00%> (-2.20%) ⬇️

... and 16 files with indirect coverage changes

@gringolito gringolito merged commit dec5202 into master Dec 11, 2024
4 checks passed
@gringolito gringolito deleted the bugfix/concurrent-file-writes branch December 11, 2024 17:45
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.

1 participant