stormtroopers 0.1.2 → 0.1.3
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/stormtroopers/manager.rb +2 -12
- data/lib/stormtroopers/version.rb +1 -1
- metadata +1 -1
@@ -6,15 +6,6 @@ require 'active_support/hash_with_indifferent_access'
|
|
6
6
|
require_relative "./already_running"
|
7
7
|
|
8
8
|
|
9
|
-
if ENV["DJ_SPEED"] == "ludicrous"
|
10
|
-
# Go to ludicrous speed (http://www.youtube.com/watch?v=mk7VWcuVOf0) by
|
11
|
-
# overriding Delayed::Job#reserve to do the bare minimum to return a job.
|
12
|
-
# This will cause all of our workers to pick up jobs from ANY queue, so use
|
13
|
-
# with caution!
|
14
|
-
|
15
|
-
end
|
16
|
-
|
17
|
-
|
18
9
|
module Stormtroopers
|
19
10
|
class Manager
|
20
11
|
include Singleton
|
@@ -34,9 +25,8 @@ module Stormtroopers
|
|
34
25
|
logger.info "Ludicrous speed? Sir! we have never gone that fast before, I dont know if the ship can take it! Whats the matter Colonel Sanders? CHICKEN?!"
|
35
26
|
puts "Ludicrous speed? Sir! we have never gone that fast before, I dont know if the ship can take it! Whats the matter Colonel Sanders? CHICKEN?!"
|
36
27
|
Delayed::Backend::Mongoid::Job.class_eval do
|
37
|
-
|
38
|
-
|
39
|
-
end
|
28
|
+
def self.reserve(worker, max_run_time = Worker.max_run_time)
|
29
|
+
where(failed_at: nil, locked_at: nil).find_and_modify({"$set" => {locked_at: db_time_now, locked_by: worker.name}}, new: true)
|
40
30
|
end
|
41
31
|
end
|
42
32
|
end
|