Skip to content
Snippets Groups Projects

Clean carrierwave tempfiles

What does this MR do?

It adds a cron job for cleaning tempfiles created by carrierwave gem.

Are there points in the code the reviewer needs to double check?

Carrierwave has its own method to clean tempfiles, but it works only if cache_dir is set by default.
In GitLab cache_dir is being redefined per project in file_uploader.rb so CarrierWave.clean_cached_files! doesn't work.

Why was this MR needed?

Tempfiles are created every time when a file is being uploaded.

Does this MR meet the acceptance criteria?

What are the relevant issue numbers?

Closes #28540 (closed)

Merge request reports

Loading
Loading

Activity

Filter activity
  • Approvals
  • Assignees & reviewers
  • Comments (from bots)
  • Comments (from users)
  • Commits & branches
  • Edits
  • Labels
  • Lock status
  • Mentions
  • Merge request status
  • Tracking
  • added 6 commits

    • bffb0c87 - Changed README.md
    • f115595d - Add cron job to clean carrierwave's temfiles
    • a600169d - Reverted changes in README
    • 2b63a3df - Added merge request to changelog entry
    • 8a5200ce - Added with_deleted scope to Project
    • 40807295 - Merge branch 'clean_carrierwave_tempfiles' of gitlab.com:blackst0ne/gitlab-ce in…

    Compare with previous version

  • added 1 commit

    Compare with previous version

  • username-removed-86853 resolved all discussions

    resolved all discussions

  • Current implementation takes all existed projects in DB and removes their tempfiles.
    What should we do with existed tempfiles for already deleted projects?

  • username-removed-128633 added ~164274 ~480950 labels

    added ~164274 ~480950 labels

  • username-removed-86853 unmarked as a Work In Progress

    unmarked as a Work In Progress

  • Can anyone please review this MR?

  • added 1 commit

    Compare with previous version

  • username-removed-86853 resolved all discussions

    resolved all discussions

  • @rymai, if we decide to use carrierwave's built-in cleaning method, the old cache_dirs should be removed.
    I see two ways to get this:

    1. Add an initializer where those directories will be checked and removed. This initializer should exist some releases because there are users who don't upgrade their gitlab instances every release. We'll remove that initializer later.
    2. Let users remove that directories by themselves by pointing that out in upgrade to 9.0 release document as a separate item of upgrading process.
  • @rymai, I can't got further until you tell me what the right way it is as a GitLab core member. =)

  • Loading
  • Loading
  • Loading
  • Loading
  • Loading
  • Loading
  • Loading
  • Loading
  • Loading
  • Loading
  • Please register or sign in to reply
    Loading