mirror of
https://github.com/neocities/neocities.git
synced 2025-04-24 17:22:35 +02:00
Update screenshots doesn't need to be that crazy
This commit is contained in:
parent
d704a1b7eb
commit
715de65234
1 changed files with 1 additions and 6 deletions
7
Rakefile
7
Rakefile
|
@ -164,16 +164,11 @@ task :cleantags => [:environment] do
|
||||||
Tag.where(name: 'porn').first.update is_nsfw: true
|
Tag.where(name: 'porn').first.update is_nsfw: true
|
||||||
end
|
end
|
||||||
|
|
||||||
require 'thread/pool'
|
|
||||||
|
|
||||||
desc 'update screenshots'
|
desc 'update screenshots'
|
||||||
task :update_screenshots => [:environment] do
|
task :update_screenshots => [:environment] do
|
||||||
pool = Thread.pool 10
|
|
||||||
Site.select(:username).where(site_changed: true, is_banned: false, is_crashing: false).filter(~{updated_at: nil}).order(:updated_at.desc).all.each do |site|
|
Site.select(:username).where(site_changed: true, is_banned: false, is_crashing: false).filter(~{updated_at: nil}).order(:updated_at.desc).all.each do |site|
|
||||||
pool.process { ScreenshotWorker.new.perform site.username, 'index.html' }
|
ScreenshotWorker.perform_async site.username, 'index.html'
|
||||||
end
|
end
|
||||||
|
|
||||||
sleep
|
|
||||||
end
|
end
|
||||||
|
|
||||||
desc 'prime_space_used'
|
desc 'prime_space_used'
|
||||||
|
|
Loading…
Add table
Reference in a new issue