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

Add improved CLI interface for removing remote media #8411

Merged
merged 1 commit into from
Aug 25, 2018
Merged

Conversation

Gargron
Copy link
Member

@Gargron Gargron commented Aug 24, 2018

./bin/tootctl media remove --days 7 --background

Make the old rake task point to it. Benefits: It lets you choose whether to process files sequentially, or in background.

Fix #8187

@Gargron Gargron added the moderation Administration and moderation tooling label Aug 24, 2018
    ./bin/tootctl media remove --days 7 --background

Make the old rake task point to it
@ClearlyClaire
Copy link
Contributor

I'm not sure about adding yet another interface.
On the other hand, allowing people to run this task sequentially rather than using a queue is good, although the impact should be limited if said queue is really the lowest-priority one.

@Gargron
Copy link
Member Author

Gargron commented Aug 25, 2018

@ThibG I intend to fully remove the rake interface, but feeling some pressure to release 2.5 soon, I don't feel like I have the time to rewrite everything at once.

The problem with rake is the argument system. To use any kind of arguments for commands, I have to either use rake's insane syntax (rake task['arg1', 'arg2']), or initialize my own option parser but have it only work with -- separating the rake part from the options part, and the code for that is getting very messy (mastodon.rake is very large).

With this new interface, I can split it into multiple, organized files, and the options and arguments handling is built in.

@Gargron Gargron merged commit 793eea2 into master Aug 25, 2018
@Gargron Gargron deleted the feature-tootctl branch August 25, 2018 11:25
end
puts "Scheduled the deletion of #{nb_media_attachments} media attachments"
require_relative '../mastodon/media_cli'
cli = Mastodon::MediaCLI.new([], days: ENV['NUM_DAYS'] || 7)
Copy link
Contributor

Choose a reason for hiding this comment

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

I think that ".to_i" is requires for "['NUM_DAYS']".

However, I still feel that it is not working properly.

I executed next line.
RAILS_ENV=production NUM_DAYS=60 bundle exec rake mastodon:media:remove_remote

After that, when I executed next line, multiple jobs were added to Sidekiq.
RAILS_ENV=production bundle exec bin/tootctl media remove --days 60 --background

kyori19 pushed a commit to kyori19/mastodon that referenced this pull request Sep 20, 2018
./bin/tootctl media remove --days 7 --background

Make the old rake task point to it
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
moderation Administration and moderation tooling
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants