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

Remove temporary .zip files generated during Lift import and export #791

Merged
merged 5 commits into from
Nov 2, 2020

Conversation

johnthagen
Copy link
Collaborator

@johnthagen johnthagen commented Oct 30, 2020

Closes #786

Should help some with #656

  • The fix for LIFT export fixes a true disk space leak.
  • Since Lift import can only be performed once, there is no recurring leak fixed on the import side, but the temporary file is still removed

The following files will no longer persist after an import in .CombineFiles/<ProjectID>/Import:

  • <temp-name-with-date>.zip

Or after an export in .CombineFiles/<ProjectID>/Export:

  • <temp-name>.zip
  • LiftExport

This change is Reviewable

@johnthagen johnthagen added bug Something isn't working backend import/export labels Oct 30, 2020
@johnthagen johnthagen self-assigned this Oct 30, 2020
@johnthagen johnthagen marked this pull request as ready for review October 30, 2020 19:44
Copy link
Collaborator

@imnasnainaec imnasnainaec left a comment

Choose a reason for hiding this comment

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

Reviewable status: 0 of 2 files reviewed, 1 unresolved discussion (waiting on @imnasnainaec and @johnthagen)


Backend/Services/LiftApiServices.cs, line 271 at r1 (raw file):

Quoted 7 lines of code…
            // Compress everything
            var destinationFileName = Path.Combine(exportDir,
                Path.Combine($"LiftExportCompressed-{proj.Id}_{DateTime.Now:yyyy-MM-dd_hh-mm-ss}.zip"));
            ZipFile.CreateFromDirectory(Path.GetDirectoryName(zipDir), destinationFileName);

            // Clean up the temporary folder structure that was compressed.
            Directory.Delete(Path.Combine(exportDir, "LiftExport"), true);

It looks like the zip file is created into exportDir, which is then immediately deleted. Shouldn't zipDir be deleted instead?

Copy link
Collaborator

@imnasnainaec imnasnainaec left a comment

Choose a reason for hiding this comment

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

Reviewable status: 0 of 2 files reviewed, all discussions resolved (waiting on @imnasnainaec)


Backend/Services/LiftApiServices.cs, line 271 at r1 (raw file):

Previously, imnasnainaec (D. Ror.) wrote…
            // Compress everything
            var destinationFileName = Path.Combine(exportDir,
                Path.Combine($"LiftExportCompressed-{proj.Id}_{DateTime.Now:yyyy-MM-dd_hh-mm-ss}.zip"));
            ZipFile.CreateFromDirectory(Path.GetDirectoryName(zipDir), destinationFileName);

            // Clean up the temporary folder structure that was compressed.
            Directory.Delete(Path.Combine(exportDir, "LiftExport"), true);

It looks like the zip file is created into exportDir, which is then immediately deleted. Shouldn't zipDir be deleted instead?

Sorry, never mind, I see that it's a subfolder of exportDir (which contains zipDir) that is being deleted.

Copy link
Collaborator

@imnasnainaec imnasnainaec left a comment

Choose a reason for hiding this comment

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

Reviewed 1 of 2 files at r1.
Reviewable status: 1 of 2 files reviewed, all discussions resolved (waiting on @johnthagen)

@imnasnainaec imnasnainaec dismissed their stale review October 30, 2020 20:43

Erroneous change request

@codecov-io
Copy link

codecov-io commented Oct 31, 2020

Codecov Report

Merging #791 into master will increase coverage by 0.02%.
The diff coverage is 100.00%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master     #791      +/-   ##
==========================================
+ Coverage   51.21%   51.23%   +0.02%     
==========================================
  Files         237      237              
  Lines        6428     6431       +3     
  Branches      410      410              
==========================================
+ Hits         3292     3295       +3     
  Misses       2833     2833              
  Partials      303      303              
Flag Coverage Δ
backend 55.22% <100.00%> (+0.04%) ⬆️
frontend 47.38% <ø> (ø)

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

Impacted Files Coverage Δ
Backend/Controllers/LiftController.cs 58.01% <100.00%> (+0.65%) ⬆️
Backend/Services/LiftApiServices.cs 94.60% <100.00%> (+0.01%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 54c5409...3364b35. Read the comment docs.

Copy link
Contributor

@jasonleenaylor jasonleenaylor left a comment

Choose a reason for hiding this comment

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

Reviewed 1 of 3 files at r3, 2 of 2 files at r4.
Reviewable status: :shipit: complete! all files reviewed, all discussions resolved (waiting on @johnthagen)

@jasonleenaylor jasonleenaylor merged commit a038b68 into master Nov 2, 2020
@jasonleenaylor jasonleenaylor deleted the clean-up-temporary-import-export branch November 2, 2020 15:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backend bug Something isn't working import/export
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Backend should remove temporary files created during export and import
4 participants