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

[FIX] Fixed cleaning old files in the export_to method #8

Conversation

PauSentis
Copy link

@PauSentis PauSentis commented Sep 27, 2023

Description

Modified the condition for file deletion to ensure files older than 1 minute are removed.

@@ -80,9 +80,8 @@ def self.export_to(app_name: nil, zip: false, format: :yaml)
base_export_path = Rails.root.join("tmp/export/translations/")

files_to_delete = Dir.glob("#{base_export_path}/*").each do |f|
if File.ctime(f) > 1.minutes.ago
if File.ctime(f) < 1.minutes.ago
`rm -rf #{f}`
Copy link
Owner

Choose a reason for hiding this comment

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

Looks good but can we change this line to FileUtils.rm_r(f, force: true)

@westonganger
Copy link
Owner

I've added one comment. Is it possible we could also add a changelog for this and maybe a spec?

@westonganger
Copy link
Owner

I cant merge this as it needs specs to ensure its working correctly with this new change (which its not)

This PR will be replaced by #12

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants