diff --git a/CHANGELOG.md b/CHANGELOG.md index 131d28f6..bae9433d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -46,11 +46,14 @@ In this release we're changing the way import files are being stored. Previously This is an optional task, that will not affect your points or other data. Big imports might take a while to migrate, so be patient. +Also, you can now migrate existing exports to the new storage using the `rake exports:migrate_to_new_storage` task (in the container shell) or just delete them. + If your hardware doesn't have enough memory to migrate the imports, you can delete your imports and re-import them. ## Added - Sentry is now can be used for error tracking. +- Subscription management is now available in non self-hosted mode. ## Changed diff --git a/app/jobs/app_version_checking_job.rb b/app/jobs/app_version_checking_job.rb index a6fc2d9b..2463326d 100644 --- a/app/jobs/app_version_checking_job.rb +++ b/app/jobs/app_version_checking_job.rb @@ -2,6 +2,7 @@ class AppVersionCheckingJob < ApplicationJob queue_as :default + sidekiq_options retry: false def perform Rails.cache.delete(CheckAppVersion::VERSION_CACHE_KEY) diff --git a/app/models/export.rb b/app/models/export.rb index 4f8ac998..03e6e432 100644 --- a/app/models/export.rb +++ b/app/models/export.rb @@ -17,9 +17,22 @@ class Export < ApplicationRecord Exports::Create.new(export: self).call end + def migrate_to_new_storage + file.attach(io: File.open("public/#{url}"), filename: name) + update!(url: nil) + + File.delete("public/#{url}") + rescue StandardError => e + Rails.logger.debug("Error migrating export #{id}: #{e.message}") + end + private def remove_attached_file file.purge_later + + File.delete("public/#{url}") + rescue StandardError => e + Rails.logger.debug("Error removing export #{id}: #{e.message}") end end diff --git a/app/views/exports/index.html.erb b/app/views/exports/index.html.erb index cc48435d..eaf393b4 100644 --- a/app/views/exports/index.html.erb +++ b/app/views/exports/index.html.erb @@ -41,10 +41,10 @@