sidekiq 0.5.1 → 0.6.0
Sign up to get free protection for your applications and to get access to all the features.
Potentially problematic release.
This version of sidekiq might be problematic. Click here for more details.
- data/.gitignore +5 -0
- data/.rvmrc +2 -1
- data/Changes.md +11 -0
- data/LICENSE +11 -4
- data/README.md +1 -7
- data/TODO.md +0 -1
- data/bin/sidekiq +2 -0
- data/examples/por.rb +17 -0
- data/examples/sinkiq.rb +57 -0
- data/lib/sidekiq.rb +1 -1
- data/lib/sidekiq/cli.rb +72 -34
- data/lib/sidekiq/client.rb +33 -16
- data/lib/sidekiq/manager.rb +37 -47
- data/lib/sidekiq/middleware/chain.rb +92 -0
- data/lib/sidekiq/middleware/client/resque_web_compatibility.rb +17 -0
- data/lib/sidekiq/middleware/client/unique_jobs.rb +30 -0
- data/lib/sidekiq/middleware/server/active_record.rb +13 -0
- data/lib/sidekiq/middleware/server/airbrake.rb +30 -0
- data/lib/sidekiq/middleware/server/unique_jobs.rb +17 -0
- data/lib/sidekiq/processor.rb +74 -16
- data/lib/sidekiq/redis_connection.rb +23 -0
- data/lib/sidekiq/testing.rb +34 -0
- data/lib/sidekiq/util.rb +21 -12
- data/lib/sidekiq/version.rb +1 -1
- data/lib/sidekiq/worker.rb +6 -7
- data/myapp/Gemfile +4 -1
- data/myapp/Gemfile.lock +29 -6
- data/myapp/app/controllers/work_controller.rb +9 -0
- data/myapp/app/views/work/index.html.erb +1 -0
- data/myapp/app/workers/hard_worker.rb +4 -2
- data/myapp/config/environments/development.rb +1 -0
- data/myapp/config/initializers/sidekiq.rb +1 -0
- data/myapp/config/routes.rb +4 -56
- data/sidekiq.gemspec +1 -0
- data/test/fake_env.rb +0 -0
- data/test/helper.rb +3 -0
- data/test/test_cli.rb +49 -0
- data/test/test_client.rb +52 -10
- data/test/test_manager.rb +11 -6
- data/test/test_middleware.rb +39 -20
- data/test/test_processor.rb +3 -2
- data/test/test_stats.rb +79 -0
- data/test/test_testing.rb +32 -0
- metadata +47 -18
- data/Gemfile.lock +0 -32
- data/lib/sidekiq/middleware.rb +0 -89
- data/test/timed_queue.rb +0 -42
data/test/timed_queue.rb
DELETED
@@ -1,42 +0,0 @@
|
|
1
|
-
require 'thread'
|
2
|
-
require 'timeout'
|
3
|
-
|
4
|
-
class TimedQueue
|
5
|
-
def initialize
|
6
|
-
@que = []
|
7
|
-
@mutex = Mutex.new
|
8
|
-
@resource = ConditionVariable.new
|
9
|
-
end
|
10
|
-
|
11
|
-
def push(obj)
|
12
|
-
@mutex.synchronize do
|
13
|
-
@que.push obj
|
14
|
-
@resource.broadcast
|
15
|
-
end
|
16
|
-
end
|
17
|
-
alias_method :<<, :push
|
18
|
-
|
19
|
-
def timed_pop(timeout=0.5)
|
20
|
-
deadline = Time.now + timeout
|
21
|
-
@mutex.synchronize do
|
22
|
-
loop do
|
23
|
-
return @que.shift unless @que.empty?
|
24
|
-
to_wait = deadline - Time.now
|
25
|
-
raise Timeout::Error, "Waited #{timeout} sec" if to_wait <= 0
|
26
|
-
@resource.wait(@mutex, to_wait)
|
27
|
-
end
|
28
|
-
end
|
29
|
-
end
|
30
|
-
|
31
|
-
def empty?
|
32
|
-
@que.empty?
|
33
|
-
end
|
34
|
-
|
35
|
-
def clear
|
36
|
-
@que.clear
|
37
|
-
end
|
38
|
-
|
39
|
-
def length
|
40
|
-
@que.length
|
41
|
-
end
|
42
|
-
end
|