mirror of
https://github.com/neocities/neocities.git
synced 2025-04-24 17:22:35 +02:00
add domain index, check uri on screenshots, set workers to system cpu core count
This commit is contained in:
parent
ea927551ef
commit
f109b416a0
3 changed files with 14 additions and 3 deletions
9
migrations/117_add_sites_domain_index.rb
Normal file
9
migrations/117_add_sites_domain_index.rb
Normal file
|
@ -0,0 +1,9 @@
|
|||
Sequel.migration do
|
||||
up {
|
||||
DB.add_index :sites, :domain
|
||||
}
|
||||
|
||||
down {
|
||||
DB.drop_index :sites, :domain
|
||||
}
|
||||
end
|
|
@ -7,8 +7,7 @@ environment 'production'
|
|||
pidfile '/var/run/neocities/neocities.pid'
|
||||
stdout_redirect '/var/log/neocities/neocities.stdout.log', '/var/log/neocities/neocities.stderr.log', true
|
||||
quiet
|
||||
workers 8
|
||||
#workers Facter.value('processors')['count']
|
||||
workers Facter.value('processors')['count']
|
||||
preload_app!
|
||||
on_worker_boot { DB.disconnect }
|
||||
bind 'unix:/var/run/neocities/neocities.sock?backlog=2048'
|
||||
|
|
|
@ -45,7 +45,10 @@ class ScreenshotWorker
|
|||
|
||||
begin
|
||||
base_image_tmpfile_path = "/tmp/#{SecureRandom.uuid}.png"
|
||||
File.write base_image_tmpfile_path, HTTP.basic_auth(user: api_user, pass: api_password).get(uri).to_s
|
||||
|
||||
http_resp = HTTP.basic_auth(user: api_user, pass: api_password).get(uri)
|
||||
BlackBox.new(site, path).check_uri(http_resp.headers['X-URL'])
|
||||
File.write base_image_tmpfile_path, http_resp.to_s
|
||||
|
||||
user_screenshots_path = File.join SCREENSHOTS_PATH, Site.sharding_dir(username), username
|
||||
screenshot_path = File.join user_screenshots_path, File.dirname(path_for_screenshot)
|
||||
|
|
Loading…
Add table
Reference in a new issue