From 52713937c58d2ee9a3259d01b67c8fb0bbdb3866 Mon Sep 17 00:00:00 2001 From: Kyle Drake Date: Sun, 23 Jun 2013 18:40:34 -0700 Subject: [PATCH] timeout fixes, UTF8 for templates --- Rakefile | 5 +++++ environment.rb | 2 +- jobs/screenshot_job.rb | 2 +- views/templates/index.slim | 1 + views/templates/not_found.slim | 3 ++- 5 files changed, 10 insertions(+), 3 deletions(-) diff --git a/Rakefile b/Rakefile index 6a9be477..bec7be5a 100644 --- a/Rakefile +++ b/Rakefile @@ -34,3 +34,8 @@ task :parse_logs => [:environment] do end end + +desc 'Update screenshots' +task :update_screenshots => [:environment] do + Site.select(:username).filter(is_banned: false).filter(~{updated_at: nil}).order(:updated_at.desc).all.collect {|s| Backburner.enqueue ScreenshotJob, s.username } +end diff --git a/environment.rb b/environment.rb index 763c7d6f..a22ebf48 100644 --- a/environment.rb +++ b/environment.rb @@ -49,5 +49,5 @@ end Backburner.configure do |config| config.max_job_retries = 3 config.retry_delay = 200 - config.respond_timeout = 20 + config.respond_timeout = 120 end diff --git a/jobs/screenshot_job.rb b/jobs/screenshot_job.rb index e59daf64..6912cf3c 100644 --- a/jobs/screenshot_job.rb +++ b/jobs/screenshot_job.rb @@ -15,7 +15,7 @@ class ScreenshotJob driver = Selenium::WebDriver.for :remote, url: $config['phantomjs_url'][rand($config['phantomjs_url'].length)], desired_capabilities: caps driver.manage.window.resize_to 1280, 720 - wait = Selenium::WebDriver::Wait.new(:timeout => 5) # seconds + wait = Selenium::WebDriver::Wait.new(:timeout => 30) # seconds wait.until { driver.navigate.to "http://#{username}.neocities.org" driver.save_screenshot screenshot.path diff --git a/views/templates/index.slim b/views/templates/index.slim index 3e46b5d9..c43de348 100644 --- a/views/templates/index.slim +++ b/views/templates/index.slim @@ -1,6 +1,7 @@ doctype html html head + meta charset="utf-8" title #{template_site_title @site.username} - Front Page body p This is a new page! Coming soon. diff --git a/views/templates/not_found.slim b/views/templates/not_found.slim index 58178574..bfdc8e59 100644 --- a/views/templates/not_found.slim +++ b/views/templates/not_found.slim @@ -1,5 +1,6 @@ html head + meta charset="utf-8" title #{template_site_title @site.username} - Not Found body - p The requested page was not found. \ No newline at end of file + p The requested page was not found.