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

refactor(transfer): improve the reliability of the transfer #883

Merged
merged 2 commits into from
May 25, 2024

Conversation

qwqcode
Copy link
Member

@qwqcode qwqcode commented May 25, 2024

This PR includes a refactor of the transfer (import/export) functionality:

  • Added cache to the export comments feature to solve the N+1 issue and improve export speed.
  • Added transaction rollback functionality to the import comments feature to roll back data in case of errors.
  • Implemented comprehensive error handling for importing comments, rather than muting errors.
  • Fixed an issue where the RootID Map could not be correctly generated when the Artran object ID was not purely numeric.
  • Added complete unit tests for the import/export functionality.
  • Automatically modified Artran object's user nick and email to "Anonymous" if they are empty or invalid (previously, this would prevent User creation).
  • Skipped importing comments when the Artran object's PageKey or SiteName is empty (unless the TargetSiteName import parameter is also unspecified).
  • Decoupled artransfer and dao packages by separating relevant DB operation functions under the DAO package into independent functions located in artransfer.
    • Since the DAO's DB operation functions automatically cache and do not support transactions, independent implementation of functions in artransfer/query.go was needed to reduce complexity.
  • And various other issues.

Copy link

codecov bot commented May 25, 2024

Codecov Report

Attention: Patch coverage is 74.10926% with 109 lines in your changes are missing coverage. Please review.

Project coverage is 27.38%. Comparing base (824f122) to head (77c6217).
Report is 1 commits behind head on master.

Files Patch % Lines
internal/artransfer/importer.go 71.09% 31 Missing and 19 partials ⚠️
cmd/import.go 0.00% 21 Missing ⚠️
internal/artransfer/console.go 82.95% 10 Missing and 5 partials ⚠️
server/handler/transfer_import.go 0.00% 11 Missing ⚠️
internal/artransfer/importer_query.go 76.92% 4 Missing and 2 partials ⚠️
internal/artransfer/base.go 83.33% 4 Missing ⚠️
internal/artransfer/url_resolver.go 75.00% 2 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master     #883      +/-   ##
==========================================
+ Coverage   25.23%   27.38%   +2.15%     
==========================================
  Files         196      197       +1     
  Lines        8093     8146      +53     
==========================================
+ Hits         2042     2231     +189     
+ Misses       5924     5782     -142     
- Partials      127      133       +6     
Flag Coverage Δ
go 27.38% <74.10%> (+2.15%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@qwqcode
Copy link
Member Author

qwqcode commented May 25, 2024

fixes #866

@qwqcode qwqcode merged commit dbb3c55 into master May 25, 2024
12 checks passed
@qwqcode qwqcode deleted the refactor/transfer branch May 25, 2024 10:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant