-
-
Notifications
You must be signed in to change notification settings - Fork 7k
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
Change tootctl to use inline parallelization instead of Sidekiq #11776
Conversation
d4aea03
to
1d8940c
Compare
tootctl media remove
to use inline parallelization1d8940c
to
4178725
Compare
Won't removing the workers cause issues if someone updates their instance while such tasks are queued? |
Since the workers are only used by the tootctl commands such timing is unlikely. I would prefer not to keep dead code around! |
lib/mastodon/cli_helper.rb
Outdated
scope.reorder(nil).find_each do |item| | ||
progress.total = futures.size + 1 if progress.total < futures.size + 1 | ||
|
||
futures << Concurrent::Future.execute(executor: pool) do |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
From what I understand, even though find_each
work in batches, this code will go through all the items in the query and put them in the queue, which might not be what we want, wrt. RAM usage.
Would it be possible to reap finished jobs as soon as possible and block whenever the pool is busy?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The futures start processing as soon as they are created, the map over values at the end is just to block execution until they all finish. What is stored are the futures and the return values, which are numbers in our case, not the ActiveRecord records, so it should help with memory usage.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm still worried about it being too much if the tasks are slow. I guess it could be interesting to see how it runs for pruning old remote media on m.s
0d488ed
to
1fe542e
Compare
1fe542e
to
d78dc49
Compare
- Remove --background option - Add --concurrency(=5) option - Add progress bars
d78dc49
to
c87c6d5
Compare
…odon#11776) - Remove --background option - Add --concurrency(=5) option - Add progress bars
…allelization instead of Sidekiq - Remove --background option - Add --concurrency(=5) option - Add progress bars
.
-c
/--concurrency
flag--background
flagCommands affected by change (unless specified otherwise, progress bar and parallelization):
tootctl accounts rotate
(not parallelized)tootctl accounts cull
tootctl accounts refresh
tootctl accounts follow
tootctl accounts unfollow
tootctl accounts reset-relationships
(not parallelized)tootctl cache recount
tootctl domains purge
tootctl domains crawl
tootctl feeds build
tootctl media remove
tootctl preview_cards remove
Examples:
tootctl media remove --days=60 -c 20
will remove media older than 60 days, 20 at a time