Skip to content

Instantly share code, notes, and snippets.

View kristianhellquist's full-sized avatar

Kristian Hellquist kristianhellquist

View GitHub Profile
@kristianhellquist
kristianhellquist / gist:5106947
Created March 7, 2013 10:07
Solr full stats output
/admin/file avgRequestsPerSecond: 0.0
/admin/file errors: 0
/admin/file handlerStart: 1362440195926
/admin/file requests: 0
/admin/file timeouts: 0
/admin/file totalTime: 0
/admin/luke avgRequestsPerSecond: 0.0
/admin/luke errors: 0
/admin/luke handlerStart: 1362440195924
/admin/luke requests: 0
@kristianhellquist
kristianhellquist / gist:5211683
Created March 21, 2013 09:01
Delayed job, fetching and locking a job
# We get up to 5 jobs from the db. In case we cannot get exclusive access to a job we try the next.
# this leads to a more even distribution of jobs across the worker processes
find_available(worker.name, 5, max_run_time).detect do |job|
job.lock_exclusively!(max_run_time, worker.name)
end
# Find a few candidate jobs to run (in case some immediately get locked by others).
def self.find_available(worker_name, limit = 5, max_run_time = Worker.max_run_time)
@kristianhellquist
kristianhellquist / gist:5395050
Created April 16, 2013 10:54
Check model pressroom with rubocop
rubocop app/models/pressroom.rb
== app/models/pressroom.rb ==
C: 1: Missing encoding comment.
C: 26: Ruby 1.8 hash syntax detected
C: 26: Ruby 1.8 hash syntax detected
C: 27: Ruby 1.8 hash syntax detected
C: 27: Ruby 1.8 hash syntax detected
C: 40: Ruby 1.8 hash syntax detected
C: 42: Ruby 1.8 hash syntax detected
C: 42: Line is too long. [90/79]