Skip to content
Snippets Groups Projects
  1. Feb 20, 2020
  2. Feb 12, 2019
  3. Dec 06, 2018
    • Jan Provaznik's avatar
      Fixed before_destroy callback · d039c167
      Jan Provaznik authored
      remove_file_uploads should be called both with and w/o
      the flag - we need to decide which way to use on instance level.
      d039c167
    • Jan Provaznik's avatar
      Allow pass additional options to use_fast_destroy · 4ded0411
      Jan Provaznik authored
      These options are then used when setting before destroy callback.
      4ded0411
    • Jan Provaznik's avatar
      Enabled feature flag for fast deletions · 9ccf8d03
      Jan Provaznik authored
      Fast destroy is used only if the feature flag is enabled, otherwise
      uploads are still deleted using carrier wave. It's disabled by default.
      9ccf8d03
    • Jan Provaznik's avatar
      Use FastDestroy for deleting uploads · 239fdc78
      Jan Provaznik authored
      It gathers list of file paths to delete before destroying
      the parent object. Then after the parent_object is destroyed
      these paths are scheduled for deletion asynchronously.
      
      Carrierwave needed associated model for deleting upload file.
      To avoid this requirement, simple Fog/File layer is used directly
      for file deletion, this allows us to use just a simple list of paths.
      239fdc78
  4. Nov 01, 2018
  5. Aug 07, 2018
  6. Jun 05, 2018
    • Sean McGivern's avatar
      Fix an N+1 in avatar URLs · 6ecf819f
      Sean McGivern authored
      This is tricky: the query was being run in
      `ObjectStorage::Extension::RecordsUploads#retrieve_from_store!`, but we can't
      just add batch loading there, because the `#upload=` method there would use the
      result immediately, making the batch only have one item.
      
      Instead, we can pre-emptively add an item to the batch whenever an avatarable
      object is initialized, and then reuse that batch item in
      `#retrieve_from_store!`. However, this also has problems:
      
      1. There is a lot of logic in `Avatarable#retrieve_upload_from_batch`.
      2. Some of that logic constructs a 'fake' model for the batch key. This should
         be fine, because of ActiveRecord's override of `#==`, but it relies on that
         staying the same.
      6ecf819f
  7. May 16, 2018
    • Jan Provaznik's avatar
      Fixed typo · 8c0166f2
      Jan Provaznik authored
      8c0166f2
    • Jan Provaznik's avatar
      Use find_in_batches instead of destroy_all · c81a37c1
      Jan Provaznik authored
      destroy_all loads all records at once
      c81a37c1
    • Jan Provaznik's avatar
      Delete remote uploads · 7da3b2cd
      Jan Provaznik authored
      ObjectStore uploader requires presence of associated `uploads` record
      when deleting the upload file (through the carrierwave's after_commit
      hook) because we keep info whether file is LOCAL or REMOTE in `upload`
      object.
      
      For this reason we can not destroy uploads as "dependent: :destroy" hook
      because these would be deleted too soon. Instead we rely on
      carrierwave's hook to destroy `uploads` in after_commit hook.
      
      But in before_destroy hook we still have to delete not-mounted uploads
      (which don't use carrierwave's destroy hook). This has to be done in
      before_Destroy instead of after_commit because `FileUpload` requires
      existence of model's object on destroy action.
      
      This is not ideal state of things, in a next step we should investigate
      how to unify model dependencies so we can use same workflow for all
      uploads.
      
      Related to #45425
      7da3b2cd
Loading