resque-scheduler 2.5.1 → 4.10.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (83) hide show
  1. checksums.yaml +7 -0
  2. data/.github/dependabot.yml +12 -0
  3. data/.github/funding.yml +4 -0
  4. data/.github/workflows/codeql-analysis.yml +59 -0
  5. data/.github/workflows/rubocop.yml +27 -0
  6. data/.github/workflows/ruby.yml +81 -0
  7. data/AUTHORS.md +25 -0
  8. data/CHANGELOG.md +539 -0
  9. data/CODE_OF_CONDUCT.md +74 -0
  10. data/Gemfile +26 -2
  11. data/README.md +291 -70
  12. data/Rakefile +8 -19
  13. data/exe/resque-scheduler +5 -0
  14. data/lib/resque/scheduler/cli.rb +147 -0
  15. data/lib/resque/scheduler/configuration.rb +102 -0
  16. data/lib/resque/scheduler/delaying_extensions.rb +371 -0
  17. data/lib/resque/scheduler/env.rb +85 -0
  18. data/lib/resque/scheduler/extension.rb +13 -0
  19. data/lib/resque/scheduler/failure_handler.rb +11 -0
  20. data/lib/resque/scheduler/lock/base.rb +13 -4
  21. data/lib/resque/scheduler/lock/basic.rb +4 -5
  22. data/lib/resque/scheduler/lock/resilient.rb +52 -43
  23. data/lib/resque/scheduler/lock.rb +2 -1
  24. data/lib/resque/scheduler/locking.rb +104 -0
  25. data/lib/resque/scheduler/logger_builder.rb +83 -0
  26. data/lib/resque/scheduler/plugin.rb +31 -0
  27. data/lib/resque/scheduler/scheduling_extensions.rb +142 -0
  28. data/lib/{resque_scheduler → resque/scheduler}/server/views/delayed.erb +21 -12
  29. data/lib/{resque_scheduler → resque/scheduler}/server/views/delayed_schedules.erb +1 -1
  30. data/lib/{resque_scheduler → resque/scheduler}/server/views/delayed_timestamp.erb +1 -1
  31. data/lib/resque/scheduler/server/views/scheduler.erb +58 -0
  32. data/lib/{resque_scheduler → resque/scheduler}/server/views/search.erb +4 -7
  33. data/lib/{resque_scheduler → resque/scheduler}/server/views/search_form.erb +1 -5
  34. data/lib/resque/scheduler/server.rb +268 -0
  35. data/lib/resque/scheduler/signal_handling.rb +40 -0
  36. data/lib/{resque_scheduler → resque/scheduler}/tasks.rb +3 -6
  37. data/lib/resque/scheduler/util.rb +39 -0
  38. data/lib/resque/scheduler/version.rb +7 -0
  39. data/lib/resque/scheduler.rb +271 -199
  40. data/lib/resque-scheduler.rb +3 -1
  41. data/resque-scheduler.gemspec +53 -20
  42. metadata +176 -132
  43. data/.gitignore +0 -11
  44. data/.rubocop.yml +0 -129
  45. data/.simplecov +0 -1
  46. data/.travis.yml +0 -21
  47. data/HISTORY.md +0 -226
  48. data/ROADMAP.md +0 -10
  49. data/bin/resque-scheduler +0 -5
  50. data/examples/Rakefile +0 -2
  51. data/examples/config/initializers/resque-web.rb +0 -37
  52. data/examples/dynamic-scheduling/README.md +0 -28
  53. data/examples/dynamic-scheduling/app/jobs/fix_schedules_job.rb +0 -54
  54. data/examples/dynamic-scheduling/app/jobs/send_email_job.rb +0 -9
  55. data/examples/dynamic-scheduling/app/models/user.rb +0 -16
  56. data/examples/dynamic-scheduling/config/resque.yml +0 -4
  57. data/examples/dynamic-scheduling/config/static_schedule.yml +0 -7
  58. data/examples/dynamic-scheduling/lib/tasks/resque.rake +0 -48
  59. data/examples/run-resque-web +0 -3
  60. data/lib/resque/scheduler_locking.rb +0 -91
  61. data/lib/resque_scheduler/cli.rb +0 -160
  62. data/lib/resque_scheduler/logger_builder.rb +0 -70
  63. data/lib/resque_scheduler/plugin.rb +0 -28
  64. data/lib/resque_scheduler/server/views/scheduler.erb +0 -36
  65. data/lib/resque_scheduler/server.rb +0 -182
  66. data/lib/resque_scheduler/util.rb +0 -34
  67. data/lib/resque_scheduler/version.rb +0 -5
  68. data/lib/resque_scheduler.rb +0 -386
  69. data/script/migrate_to_timestamps_set.rb +0 -14
  70. data/tasks/resque_scheduler.rake +0 -2
  71. data/test/cli_test.rb +0 -286
  72. data/test/delayed_queue_test.rb +0 -449
  73. data/test/redis-test.conf +0 -108
  74. data/test/resque-web_test.rb +0 -199
  75. data/test/scheduler_args_test.rb +0 -190
  76. data/test/scheduler_hooks_test.rb +0 -23
  77. data/test/scheduler_locking_test.rb +0 -242
  78. data/test/scheduler_setup_test.rb +0 -95
  79. data/test/scheduler_task_test.rb +0 -35
  80. data/test/scheduler_test.rb +0 -344
  81. data/test/support/redis_instance.rb +0 -134
  82. data/test/test_helper.rb +0 -131
  83. /data/lib/{resque_scheduler → resque/scheduler}/server/views/requeue-params.erb +0 -0
data/test/test_helper.rb DELETED
@@ -1,131 +0,0 @@
1
- # Pretty much copied this file from the resque test_helper since we want
2
- # to do all the same stuff
3
-
4
- dir = File.dirname(File.expand_path(__FILE__))
5
-
6
- require 'rubygems'
7
- require 'bundler/setup'
8
-
9
- require 'simplecov' unless RUBY_VERSION < '1.9'
10
-
11
- require 'test/unit'
12
- require 'mocha/setup'
13
- require 'resque'
14
-
15
- $LOAD_PATH.unshift File.dirname(File.expand_path(__FILE__)) + '/../lib'
16
- require 'resque_scheduler'
17
- require 'resque_scheduler/server'
18
-
19
- unless ENV['RESQUE_SCHEDULER_DISABLE_TEST_REDIS_SERVER']
20
- # Start our own Redis when the tests start. RedisInstance will take care of
21
- # starting and stopping.
22
- require File.expand_path('../support/redis_instance', __FILE__)
23
- RedisInstance.run!
24
- end
25
-
26
- at_exit do
27
- next if $!
28
-
29
- if defined?(MiniTest)
30
- exit_code = MiniTest::Unit.new.run(ARGV)
31
- else
32
- exit_code = Test::Unit::AutoRunner.run
33
- end
34
-
35
- exit(exit_code || 0)
36
- end
37
-
38
- ##
39
- # test/spec/mini 3
40
- # http://gist.github.com/25455
41
- # chris@ozmm.org
42
- #
43
- def context(*args, &block)
44
- return super unless (name = args.first) && block
45
- require 'test/unit'
46
- klass = Class.new(defined?(ActiveSupport::TestCase) ? ActiveSupport::TestCase : Test::Unit::TestCase) do
47
- def self.test(name, &block)
48
- define_method("test_#{name.gsub(/\W/,'_')}", &block) if block
49
- end
50
- def self.xtest(*args) end
51
- def self.setup(&block) define_method(:setup, &block) end
52
- def self.teardown(&block) define_method(:teardown, &block) end
53
- end
54
- (class << klass; self end).send(:define_method, :name) { name.gsub(/\W/,'_') }
55
- klass.class_eval(&block)
56
- end
57
-
58
- unless defined?(Rails)
59
- module Rails
60
- class << self
61
- attr_accessor :env
62
- end
63
- end
64
- end
65
-
66
- class FakeCustomJobClass
67
- def self.scheduled(queue, klass, *args); end
68
- end
69
-
70
- class FakeCustomJobClassEnqueueAt
71
- @queue = :test
72
- def self.scheduled(queue, klass, *args); end
73
- end
74
-
75
- class SomeJob
76
- def self.perform(repo_id, path)
77
- end
78
- end
79
-
80
- class SomeIvarJob < SomeJob
81
- @queue = :ivar
82
- end
83
-
84
- class SomeQuickJob < SomeJob
85
- @queue = :quick
86
- end
87
-
88
- class SomeRealClass
89
- def self.queue
90
- :some_real_queue
91
- end
92
- end
93
-
94
- class JobWithParams
95
- def self.perform(*args)
96
- @args = args
97
- end
98
- end
99
-
100
- JobWithoutParams = Class.new(JobWithParams)
101
-
102
- %w(
103
- APP_NAME
104
- DYNAMIC_SCHEDULE
105
- LOGFILE
106
- LOGFORMAT
107
- MUTE
108
- RAILS_ENV
109
- RESQUE_SCHEDULER_INTERVAL
110
- VERBOSE
111
- ).each do |envvar|
112
- ENV[envvar] = nil
113
- end
114
-
115
- def nullify_logger
116
- Resque::Scheduler.configure do |c|
117
- c.mute = nil
118
- c.verbose = nil
119
- c.logfile = nil
120
- c.logger = nil
121
- end
122
-
123
- ENV['LOGFILE'] = nil
124
- end
125
-
126
- def restore_devnull_logfile
127
- nullify_logger
128
- ENV['LOGFILE'] = '/dev/null'
129
- end
130
-
131
- restore_devnull_logfile