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

NEXT-37516 - Changed import error handling for database deadlock error #33

Merged
merged 1 commit into from
Aug 20, 2024

Conversation

CR0YD
Copy link
Contributor

@CR0YD CR0YD commented Aug 20, 2024

To counter errors like database deadlocks happening during an import of a chunk I reorganized the code in the sync_chunk method so that we can use the new -t --try-count argument of the sync command to specify the number of tries a request gets when it returns a processable error.
Errors that should be caught and processed can be added to the match statement in the function.
New error structures can now be added in the SwError enum.
New error codes can be added as constants like ERROR_CODE_DEADLOCK in the SwError enum.

@CR0YD CR0YD self-assigned this Aug 20, 2024
@LarsKemper LarsKemper added bug Something isn't working enhancement New feature or request labels Aug 20, 2024
Copy link
Member

@LarsKemper LarsKemper left a comment

Choose a reason for hiding this comment

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

Nice job 💪 Only the failing test 😅

@CR0YD CR0YD force-pushed the next-37516/changed-import-deadlock-error-handling branch from d8cabd8 to 8d6cbef Compare August 20, 2024 13:41
Copy link

Summary of the total line code coverage for the whole codebase

Total lines Covered Skipped % (pr) % (main)
2022 1132 890 55.98 57.03
Summary of each file (click to expand)
File Total lines Covered Skipped %
src/api/filter.rs 171 168 3 98.25
src/api/mod.rs 369 62 307 16.80
src/cli.rs 45 31 14 68.89
src/config_file.rs 76 56 20 73.68
src/data/export.rs 136 0 136 0.00
src/data/import.rs 162 0 162 0.00
src/data/transform/mod.rs 334 259 75 77.54
src/data/transform/script.rs 292 258 34 88.36
src/data/validate.rs 298 298 0 100.00
src/main.rs 139 0 139 0.00
More details (click to expand)

Download full HTML report

You can download the full HTML report here: click to download
Hint: You need to extract it locally and open the index.html, there you can see which lines are not covered in each file.

You can also generate these reports locally

For that, you need to install cargo-llvm-cov, then you can run:

cargo llvm-cov --all-features --no-fail-fast --open

Hint: There are also other ways to see code coverage in Rust. For example with RustRover, you can execute tests with coverage generation directly in the IDE.

Remember

Your tests should be meaningful and not just be written to raise the coverage.
Coverage is just a tool to detect forgotten code paths you may want to think about, not your instructor to write tests

Copy link
Contributor

@MalteJanz MalteJanz left a comment

Choose a reason for hiding this comment

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

LGTM 👍

@MalteJanz MalteJanz merged commit 9bec912 into main Aug 20, 2024
3 checks passed
@MalteJanz MalteJanz deleted the next-37516/changed-import-deadlock-error-handling branch August 20, 2024 14:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants