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.

Files changed (47) hide show
  1. data/.gitignore +5 -0
  2. data/.rvmrc +2 -1
  3. data/Changes.md +11 -0
  4. data/LICENSE +11 -4
  5. data/README.md +1 -7
  6. data/TODO.md +0 -1
  7. data/bin/sidekiq +2 -0
  8. data/examples/por.rb +17 -0
  9. data/examples/sinkiq.rb +57 -0
  10. data/lib/sidekiq.rb +1 -1
  11. data/lib/sidekiq/cli.rb +72 -34
  12. data/lib/sidekiq/client.rb +33 -16
  13. data/lib/sidekiq/manager.rb +37 -47
  14. data/lib/sidekiq/middleware/chain.rb +92 -0
  15. data/lib/sidekiq/middleware/client/resque_web_compatibility.rb +17 -0
  16. data/lib/sidekiq/middleware/client/unique_jobs.rb +30 -0
  17. data/lib/sidekiq/middleware/server/active_record.rb +13 -0
  18. data/lib/sidekiq/middleware/server/airbrake.rb +30 -0
  19. data/lib/sidekiq/middleware/server/unique_jobs.rb +17 -0
  20. data/lib/sidekiq/processor.rb +74 -16
  21. data/lib/sidekiq/redis_connection.rb +23 -0
  22. data/lib/sidekiq/testing.rb +34 -0
  23. data/lib/sidekiq/util.rb +21 -12
  24. data/lib/sidekiq/version.rb +1 -1
  25. data/lib/sidekiq/worker.rb +6 -7
  26. data/myapp/Gemfile +4 -1
  27. data/myapp/Gemfile.lock +29 -6
  28. data/myapp/app/controllers/work_controller.rb +9 -0
  29. data/myapp/app/views/work/index.html.erb +1 -0
  30. data/myapp/app/workers/hard_worker.rb +4 -2
  31. data/myapp/config/environments/development.rb +1 -0
  32. data/myapp/config/initializers/sidekiq.rb +1 -0
  33. data/myapp/config/routes.rb +4 -56
  34. data/sidekiq.gemspec +1 -0
  35. data/test/fake_env.rb +0 -0
  36. data/test/helper.rb +3 -0
  37. data/test/test_cli.rb +49 -0
  38. data/test/test_client.rb +52 -10
  39. data/test/test_manager.rb +11 -6
  40. data/test/test_middleware.rb +39 -20
  41. data/test/test_processor.rb +3 -2
  42. data/test/test_stats.rb +79 -0
  43. data/test/test_testing.rb +32 -0
  44. metadata +47 -18
  45. data/Gemfile.lock +0 -32
  46. data/lib/sidekiq/middleware.rb +0 -89
  47. data/test/timed_queue.rb +0 -42
@@ -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