rufus-scheduler 3.5.0 → 3.5.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +366 -0
- data/CREDITS.md +127 -0
- data/README.md +63 -57
- data/lib/rufus/scheduler.rb +14 -17
- data/lib/rufus/scheduler/jobs.rb +6 -8
- data/rufus-scheduler.gemspec +1 -1
- metadata +7 -7
- data/CHANGELOG.txt +0 -360
- data/CREDITS.txt +0 -125
data/README.md
CHANGED
@@ -61,7 +61,7 @@ Rufus-scheduler (out of the box) is an in-process, in-memory scheduler. It uses
|
|
61
61
|
|
62
62
|
It does not persist your schedules. When the process is gone and the scheduler instance with it, the schedules are gone.
|
63
63
|
|
64
|
-
A rufus-scheduler instance will go on scheduling while it is present among the
|
64
|
+
A rufus-scheduler instance will go on scheduling while it is present among the objects in a Ruby process. To make it stop scheduling you have to call its [`#shutdown` method](#schedulershutdown).
|
65
65
|
|
66
66
|
|
67
67
|
## related and similar gems
|
@@ -89,7 +89,7 @@ I'll drive you right to the [tracks](#so-rails).
|
|
89
89
|
## Notable changes:
|
90
90
|
|
91
91
|
* As said, no more EventMachine-based scheduler
|
92
|
-
* ```scheduler.every('100') {``` will schedule every 100 seconds (previously, it would have been 0.1s). This aligns rufus-scheduler
|
92
|
+
* ```scheduler.every('100') {``` will schedule every 100 seconds (previously, it would have been 0.1s). This aligns rufus-scheduler with Ruby's ```sleep(100)```
|
93
93
|
* The scheduler isn't catching the whole of Exception anymore, only StandardError
|
94
94
|
* The error_handler is [#on_error](#rufusscheduleron_errorjob-error) (instead of #on_exception), by default it now prints the details of the error to $stderr (used to be $stdout)
|
95
95
|
* Rufus::Scheduler::TimeOutError renamed to Rufus::Scheduler::TimeoutError
|
@@ -183,7 +183,7 @@ end
|
|
183
183
|
|
184
184
|
Every jobs try hard to trigger following the frequency they were scheduled with.
|
185
185
|
|
186
|
-
Interval jobs
|
186
|
+
Interval jobs trigger, execute and then trigger again after the interval elapsed. (every jobs time between trigger times, interval jobs time between trigger termination and the next trigger start).
|
187
187
|
|
188
188
|
Cron jobs are based on the venerable cron utility (```man 5 crontab```). They trigger following a pattern given in (almost) the same language cron uses.
|
189
189
|
|
@@ -221,7 +221,7 @@ job =
|
|
221
221
|
|
222
222
|
Sometimes it pays to be less verbose.
|
223
223
|
|
224
|
-
The ```#schedule``` methods schedules an at, in or cron job. It just
|
224
|
+
The ```#schedule``` methods schedules an at, in or cron job. It just decides based on its input. It returns the Job instance.
|
225
225
|
|
226
226
|
```ruby
|
227
227
|
scheduler.schedule '10d' do; end.class
|
@@ -244,13 +244,13 @@ scheduler.repeat '* * * * *' do; end.class
|
|
244
244
|
# => Rufus::Scheduler::CronJob
|
245
245
|
```
|
246
246
|
|
247
|
-
(Yes, no combination
|
247
|
+
(Yes, no combination here gives back an IntervalJob).
|
248
248
|
|
249
249
|
### schedule blocks arguments (job, time)
|
250
250
|
|
251
251
|
A schedule block may be given 0, 1 or 2 arguments.
|
252
252
|
|
253
|
-
The first argument is "job", it's
|
253
|
+
The first argument is "job", it's simply the Job instance involved. It might be useful if the job is to be unscheduled for some reason.
|
254
254
|
|
255
255
|
```ruby
|
256
256
|
scheduler.every '10m' do |job|
|
@@ -290,7 +290,7 @@ It should work as well with cron jobs, not so with interval jobs whose next_time
|
|
290
290
|
|
291
291
|
### scheduling handler instances
|
292
292
|
|
293
|
-
It's OK to pass any object, as long as it
|
293
|
+
It's OK to pass any object, as long as it responds to #call(), when scheduling:
|
294
294
|
|
295
295
|
```ruby
|
296
296
|
class Handler
|
@@ -369,27 +369,27 @@ While paused, the scheduler still accepts schedules, but no schedule will get tr
|
|
369
369
|
|
370
370
|
### :blocking => true
|
371
371
|
|
372
|
-
By default, jobs are triggered in their own, new
|
372
|
+
By default, jobs are triggered in their own, new threads. When `:blocking => true`, the job is triggered in the scheduler thread (a new thread is not created). Yes, while a blocking job is running, the scheduler is not scheduling.
|
373
373
|
|
374
374
|
### :overlap => false
|
375
375
|
|
376
|
-
Since, by default, jobs are triggered in their own new
|
376
|
+
Since, by default, jobs are triggered in their own new threads, job instances might overlap. For example, a job that takes 10 minutes and is scheduled every 7 minutes will have overlaps.
|
377
377
|
|
378
|
-
To prevent overlap, one can set
|
378
|
+
To prevent overlap, one can set `:overlap => false`. Such a job will not trigger if one of its instances is already running.
|
379
379
|
|
380
|
-
The `:overlap` option is considered
|
380
|
+
The `:overlap` option is considered before the `:mutex` option when the scheduler is reviewing jobs for triggering.
|
381
381
|
|
382
382
|
### :mutex => mutex_instance / mutex_name / array of mutexes
|
383
383
|
|
384
|
-
When a job with a mutex triggers, the job's block is executed with the mutex around it, preventing other jobs with the same mutex
|
384
|
+
When a job with a mutex triggers, the job's block is executed with the mutex around it, preventing other jobs with the same mutex from entering (it makes the other jobs wait until it exits the mutex).
|
385
385
|
|
386
|
-
This is different from
|
386
|
+
This is different from `:overlap => false`, which is, first, limited to instances of the same job, and, second, doesn't make the incoming job instance block/wait but give up.
|
387
387
|
|
388
|
-
|
388
|
+
`:mutex` accepts a mutex instance or a mutex name (String). It also accept an array of mutex names / mutex instances. It allows for complex relations between jobs.
|
389
389
|
|
390
390
|
Array of mutexes: original idea and implementation by [Rainux Luo](https://github.com/rainux)
|
391
391
|
|
392
|
-
|
392
|
+
Note: creating lots of different mutexes is OK. Rufus-scheduler will place them in its Scheduler#mutexes hash... And they won't get garbage collected.
|
393
393
|
|
394
394
|
The `:overlap` option is considered before the `:mutex` option when the scheduler is reviewing jobs for triggering.
|
395
395
|
|
@@ -416,7 +416,7 @@ This option is for repeat jobs (cron / every) only.
|
|
416
416
|
It's used to specify the first time after which the repeat job should trigger for the first time.
|
417
417
|
|
418
418
|
In the case of an "every" job, this will be the first time (modulo the scheduler frequency) the job triggers.
|
419
|
-
For a "cron" job as well, the :first will point to the first time the job has to trigger, the following trigger
|
419
|
+
For a "cron" job as well, the :first will point to the first time the job has to trigger, the following trigger times are then determined by the cron string.
|
420
420
|
|
421
421
|
```ruby
|
422
422
|
scheduler.every '2d', :first_at => Time.now + 10 * 3600 do
|
@@ -432,7 +432,7 @@ scheduler.cron '00 14 * * *', :first_in => '3d' do
|
|
432
432
|
end
|
433
433
|
```
|
434
434
|
|
435
|
-
:first, :first_at and :first_in all accept a point in time or a duration (number or time string). Use the symbol you think
|
435
|
+
:first, :first_at and :first_in all accept a point in time or a duration (number or time string). Use the symbol you think makes your schedule more readable.
|
436
436
|
|
437
437
|
Note: it's OK to change the first_at (a Time instance) directly:
|
438
438
|
```ruby
|
@@ -487,7 +487,7 @@ scheduler.every '10m', :last_in => 10 * 3600 do
|
|
487
487
|
# ... do something every 10 minutes for 10 hours
|
488
488
|
end
|
489
489
|
```
|
490
|
-
:last, :last_at and :last_in all accept a point in time or a duration (number or time string). Use the symbol you think
|
490
|
+
:last, :last_at and :last_in all accept a point in time or a duration (number or time string). Use the symbol you think makes your schedule more readable.
|
491
491
|
|
492
492
|
Note: it's OK to change the last_at (nil or a Time instance) directly:
|
493
493
|
```ruby
|
@@ -537,7 +537,7 @@ job.times = 10
|
|
537
537
|
|
538
538
|
## Job methods
|
539
539
|
|
540
|
-
When calling a schedule method, the id (String) of the job is returned. Longer schedule methods return Job instances directly. Calling the shorter schedule methods with the :job => true also
|
540
|
+
When calling a schedule method, the id (String) of the job is returned. Longer schedule methods return Job instances directly. Calling the shorter schedule methods with the :job => true also returns Job instances instead of Job ids (Strings).
|
541
541
|
|
542
542
|
```ruby
|
543
543
|
require 'rufus-scheduler'
|
@@ -600,7 +600,7 @@ job.original
|
|
600
600
|
|
601
601
|
callable() returns the scheduled block (or the call method of the callable object passed in lieu of a block)
|
602
602
|
|
603
|
-
handler() returns nil if a block was scheduled and the instance scheduled
|
603
|
+
handler() returns nil if a block was scheduled and the instance scheduled otherwise.
|
604
604
|
|
605
605
|
```ruby
|
606
606
|
# when passing a block
|
@@ -710,7 +710,7 @@ Returns true if the job is scheduled (is due to trigger). For repeat jobs it sho
|
|
710
710
|
|
711
711
|
### pause, resume, paused?, paused_at
|
712
712
|
|
713
|
-
These four methods are only available to CronJob, EveryJob and IntervalJob instances. One can pause or resume such
|
713
|
+
These four methods are only available to CronJob, EveryJob and IntervalJob instances. One can pause or resume such jobs thanks to these methods.
|
714
714
|
|
715
715
|
```ruby
|
716
716
|
job =
|
@@ -816,7 +816,7 @@ Returns when the job will trigger (hopefully).
|
|
816
816
|
|
817
817
|
### next_time
|
818
818
|
|
819
|
-
An alias
|
819
|
+
An alias for time.
|
820
820
|
|
821
821
|
## EveryJob, IntervalJob and CronJob methods
|
822
822
|
|
@@ -846,34 +846,40 @@ Every jobs use a time duration between each start of their execution, while inte
|
|
846
846
|
|
847
847
|
## CronJob methods
|
848
848
|
|
849
|
-
###
|
850
|
-
|
851
|
-
It returns the shortest interval of time between two potential occurrences of the job.
|
852
|
-
|
853
|
-
For instance:
|
854
|
-
```ruby
|
855
|
-
Rufus::Scheduler.parse('* * * * *').frequency # ==> 60
|
856
|
-
Rufus::Scheduler.parse('* * * * * *').frequency # ==> 1
|
849
|
+
### brute_frequency
|
857
850
|
|
858
|
-
|
859
|
-
Rufus::Scheduler.parse('5 * * * *').frequency # ==> 3600
|
860
|
-
Rufus::Scheduler.parse('10,20,30 * * * *').frequency # ==> 600
|
851
|
+
An expensive method to run, it's brute. It caches its results. By default it runs for 2017 (a non leap-year).
|
861
852
|
|
862
|
-
Rufus::Scheduler.parse('10,20,30 * * * * *').frequency # ==> 10
|
863
853
|
```
|
854
|
+
require 'rufus-scheduler'
|
864
855
|
|
865
|
-
|
856
|
+
Rufus::Scheduler.parse('* * * * *').brute_frequency
|
857
|
+
#
|
858
|
+
# => #<Fugit::Cron::Frequency:0x00007fdf4520c5e8
|
859
|
+
# @span=31536000.0, @delta_min=60, @delta_max=60,
|
860
|
+
# @occurrences=525600, @span_years=1.0, @yearly_occurrences=525600.0>
|
861
|
+
#
|
862
|
+
# Occurs 525600 times in a span of 1 year (2017) and 1 day.
|
863
|
+
# There are least 60 seconds between "triggers" and at most 60 seconds.
|
866
864
|
|
867
|
-
|
865
|
+
Rufus::Scheduler.parse('0 12 * * *').brute_frequency
|
866
|
+
# => #<Fugit::Cron::Frequency:0x00007fdf451ec6d0
|
867
|
+
# @span=31536000.0, @delta_min=86400, @delta_max=86400,
|
868
|
+
# @occurrences=365, @span_years=1.0, @yearly_occurrences=365.0>
|
869
|
+
Rufus::Scheduler.parse('0 12 * * *').brute_frequency.to_debug_s
|
870
|
+
# => "dmin: 1D, dmax: 1D, ocs: 365, spn: 52W1D, spnys: 1, yocs: 365"
|
871
|
+
#
|
872
|
+
# 365 occurrences, at most 1 day between each, at least 1 day.
|
873
|
+
```
|
868
874
|
|
869
|
-
|
875
|
+
The `CronJob#frequency` method found in rufus-scheduler < 3.5 has been retired.
|
870
876
|
|
871
877
|
|
872
878
|
## looking up jobs
|
873
879
|
|
874
880
|
### Scheduler#job(job_id)
|
875
881
|
|
876
|
-
The scheduler ```#job(job_id)``` method can be used to
|
882
|
+
The scheduler ```#job(job_id)``` method can be used to look up Job instances.
|
877
883
|
|
878
884
|
```ruby
|
879
885
|
require 'rufus-scheduler'
|
@@ -905,7 +911,7 @@ Here is an example:
|
|
905
911
|
|
906
912
|
### Scheduler#jobs(:tag / :tags => x)
|
907
913
|
|
908
|
-
When scheduling a job, one can specify one or more tags attached to the job. These can be used to
|
914
|
+
When scheduling a job, one can specify one or more tags attached to the job. These can be used to look up the job later on.
|
909
915
|
|
910
916
|
```ruby
|
911
917
|
scheduler.in '10d', :tag => 'main_process' do
|
@@ -965,7 +971,7 @@ Returns since the count of seconds for which the scheduler has been running.
|
|
965
971
|
|
966
972
|
### Scheduler#join
|
967
973
|
|
968
|
-
|
974
|
+
Lets the current thread join the scheduling thread in rufus-scheduler. The thread comes back when the scheduler gets shut down.
|
969
975
|
|
970
976
|
### Scheduler#threads
|
971
977
|
|
@@ -1040,9 +1046,9 @@ TODO: talk about callable#on_error (if implemented)
|
|
1040
1046
|
|
1041
1047
|
### Rufus::Scheduler#stderr=
|
1042
1048
|
|
1043
|
-
By default, rufus-scheduler intercepts all errors (that inherit from StandardError) and dumps
|
1049
|
+
By default, rufus-scheduler intercepts all errors (that inherit from StandardError) and dumps abundant details to $stderr.
|
1044
1050
|
|
1045
|
-
If, for example, you'd like to divert that flow to another file (descriptor)
|
1051
|
+
If, for example, you'd like to divert that flow to another file (descriptor), you can reassign $stderr for the current Ruby process
|
1046
1052
|
|
1047
1053
|
```ruby
|
1048
1054
|
$stderr = File.open('/var/log/myapplication.log', 'ab')
|
@@ -1101,13 +1107,13 @@ end
|
|
1101
1107
|
|
1102
1108
|
The ```trigger_time``` is the time at which the job triggers. It might be a bit before ```Time.now```.
|
1103
1109
|
|
1104
|
-
Warning: these two callbacks are executed in the scheduler thread, not in the work threads (the threads
|
1110
|
+
Warning: these two callbacks are executed in the scheduler thread, not in the work threads (the threads where the job execution really happens).
|
1105
1111
|
|
1106
1112
|
### Rufus::Scheduler#on_pre_trigger as a guard
|
1107
1113
|
|
1108
1114
|
Returning ```false``` in on_pre_trigger will prevent the job from triggering. Returning anything else (nil, -1, true, ...) will let the job trigger.
|
1109
1115
|
|
1110
|
-
Note: your business logic should go in the scheduled block itself (or the scheduled instance). Don't put business logic in on_pre_trigger. Return false for admin reasons (backend down, etc) not for business reasons that are tied to the job itself.
|
1116
|
+
Note: your business logic should go in the scheduled block itself (or the scheduled instance). Don't put business logic in on_pre_trigger. Return false for admin reasons (backend down, etc), not for business reasons that are tied to the job itself.
|
1111
1117
|
|
1112
1118
|
```ruby
|
1113
1119
|
def s.on_pre_trigger(job, trigger_time)
|
@@ -1145,7 +1151,7 @@ This feature only works on OSes that support the flock (man 2 flock) call.
|
|
1145
1151
|
|
1146
1152
|
Starting the scheduler with ```:lockfile => ".rufus-scheduler.lock"``` will make the scheduler attempt to create and lock the file ```.rufus-scheduler.lock``` in the current working directory. If that fails, the scheduler will not start.
|
1147
1153
|
|
1148
|
-
The idea is to guarantee only one scheduler (in a group of
|
1154
|
+
The idea is to guarantee only one scheduler (in a group of schedulers sharing the same lockfile) is running.
|
1149
1155
|
|
1150
1156
|
This is useful in environments where the Ruby process holding the scheduler gets started multiple times.
|
1151
1157
|
|
@@ -1244,11 +1250,11 @@ Rufus::Scheduler.s.every '10s' { puts "hello, world!" }
|
|
1244
1250
|
|
1245
1251
|
## advanced lock schemes
|
1246
1252
|
|
1247
|
-
As seen above, rufus-scheduler proposes the [:lockfile](#lockfile--mylockfiletxt) system out of the box. If in a group of schedulers only one is supposed to run, the lockfile
|
1253
|
+
As seen above, rufus-scheduler proposes the [:lockfile](#lockfile--mylockfiletxt) system out of the box. If in a group of schedulers only one is supposed to run, the lockfile mechanism prevents schedulers that have not set/created the lockfile from running.
|
1248
1254
|
|
1249
|
-
There are
|
1255
|
+
There are situations where this is not sufficient.
|
1250
1256
|
|
1251
|
-
By overriding #lock and #unlock, one can customize how
|
1257
|
+
By overriding #lock and #unlock, one can customize how schedulers lock.
|
1252
1258
|
|
1253
1259
|
This example was provided by [Eric Lindvall](https://github.com/eric):
|
1254
1260
|
|
@@ -1305,7 +1311,7 @@ Warning: you may think you're heading towards "high availability" by using a tri
|
|
1305
1311
|
|
1306
1312
|
## parsing cronlines and time strings
|
1307
1313
|
|
1308
|
-
Rufus::Scheduler provides a class method ```.parse``` to parse time durations and cron strings. It's what it's using when receiving schedules. One can use it
|
1314
|
+
Rufus::Scheduler provides a class method ```.parse``` to parse time durations and cron strings. It's what it's using when receiving schedules. One can use it directly (no need to instantiate a Scheduler).
|
1309
1315
|
|
1310
1316
|
```ruby
|
1311
1317
|
require 'rufus-scheduler'
|
@@ -1325,13 +1331,13 @@ Rufus::Scheduler.parse(0.1)
|
|
1325
1331
|
# => 0.1
|
1326
1332
|
|
1327
1333
|
Rufus::Scheduler.parse('* * * * *')
|
1328
|
-
# => #<
|
1329
|
-
#
|
1330
|
-
#
|
1331
|
-
#
|
1334
|
+
# => #<Fugit::Cron:0x00007fb7a3045508
|
1335
|
+
# @original="* * * * *", @cron_s=nil,
|
1336
|
+
# @seconds=[0], @minutes=nil, @hours=nil, @monthdays=nil, @months=nil,
|
1337
|
+
# @weekdays=nil, @zone=nil, @timezone=nil>
|
1332
1338
|
```
|
1333
1339
|
|
1334
|
-
It returns a number when the
|
1340
|
+
It returns a number when the input is a duration and a Fugit::Cron instance when the input is a cron string.
|
1335
1341
|
|
1336
1342
|
It will raise an ArgumentError if it can't parse the input.
|
1337
1343
|
|
@@ -1384,7 +1390,7 @@ require 'rufus-scheduler'
|
|
1384
1390
|
|
1385
1391
|
Time.now
|
1386
1392
|
# => 2013-10-26 07:07:08 +0900
|
1387
|
-
Rufus::Scheduler.parse('* * * * mon#1').next_time
|
1393
|
+
Rufus::Scheduler.parse('* * * * mon#1').next_time.to_s
|
1388
1394
|
# => 2013-11-04 00:00:00 +0900
|
1389
1395
|
```
|
1390
1396
|
|
@@ -1397,7 +1403,7 @@ In this example, the cronline is supposed to trigger every last day of the month
|
|
1397
1403
|
require 'rufus-scheduler'
|
1398
1404
|
Time.now
|
1399
1405
|
# => 2013-10-26 07:22:09 +0900
|
1400
|
-
Rufus::Scheduler.parse('00 12 L * *').next_time
|
1406
|
+
Rufus::Scheduler.parse('00 12 L * *').next_time.to_s
|
1401
1407
|
# => 2013-10-31 12:00:00 +0900
|
1402
1408
|
```
|
1403
1409
|
|
@@ -1450,7 +1456,7 @@ rufus-scheduler/lib/rufus/scheduler/zotime.rb:41:
|
|
1450
1456
|
...
|
1451
1457
|
```
|
1452
1458
|
|
1453
|
-
It may happen on Windows or on systems that poorly
|
1459
|
+
It may happen on Windows or on systems that poorly hint to Ruby which timezone to use. It should be solved by setting explicitly the `ENV['TZ']` before the scheduler instantiation:
|
1454
1460
|
```ruby
|
1455
1461
|
ENV['TZ'] = 'Asia/Shanghai'
|
1456
1462
|
scheduler = Rufus::Scheduler.new
|
data/lib/rufus/scheduler.rb
CHANGED
@@ -11,7 +11,7 @@ module Rufus
|
|
11
11
|
|
12
12
|
class Scheduler
|
13
13
|
|
14
|
-
VERSION = '3.5.
|
14
|
+
VERSION = '3.5.1'
|
15
15
|
|
16
16
|
EoTime = ::EtOrbi::EoTime
|
17
17
|
|
@@ -397,15 +397,12 @@ module Rufus
|
|
397
397
|
#
|
398
398
|
def work_threads(query=:all)
|
399
399
|
|
400
|
-
ts =
|
401
|
-
threads.select { |t|
|
402
|
-
t[:rufus_scheduler_job] || t[:rufus_scheduler_work_thread]
|
403
|
-
}
|
400
|
+
ts = threads.select { |t| t[:rufus_scheduler_work_thread] }
|
404
401
|
|
405
402
|
case query
|
406
|
-
|
407
|
-
|
408
|
-
|
403
|
+
when :active then ts.select { |t| t[:rufus_scheduler_job] }
|
404
|
+
when :vacant then ts.reject { |t| t[:rufus_scheduler_job] }
|
405
|
+
else ts
|
409
406
|
end
|
410
407
|
end
|
411
408
|
|
@@ -606,15 +603,15 @@ module Rufus
|
|
606
603
|
|
607
604
|
job_class =
|
608
605
|
case job_type
|
609
|
-
|
610
|
-
|
611
|
-
|
612
|
-
|
613
|
-
|
614
|
-
|
615
|
-
|
616
|
-
|
617
|
-
|
606
|
+
when :once
|
607
|
+
opts[:_t] ||= Rufus::Scheduler.parse(t, opts)
|
608
|
+
opts[:_t].is_a?(Numeric) ? InJob : AtJob
|
609
|
+
when :every
|
610
|
+
EveryJob
|
611
|
+
when :interval
|
612
|
+
IntervalJob
|
613
|
+
when :cron
|
614
|
+
CronJob
|
618
615
|
end
|
619
616
|
|
620
617
|
job = job_class.new(self, t, opts, block || callable)
|
data/lib/rufus/scheduler/jobs.rb
CHANGED
@@ -279,6 +279,9 @@ module Rufus
|
|
279
279
|
thread =
|
280
280
|
Thread.new do
|
281
281
|
|
282
|
+
Thread.current[:rufus_scheduler_job] = true
|
283
|
+
# indicates that the thread is going to be assigned immediately
|
284
|
+
|
282
285
|
Thread.current[@scheduler.thread_key] = true
|
283
286
|
Thread.current[:rufus_scheduler_work_thread] = true
|
284
287
|
|
@@ -320,12 +323,12 @@ module Rufus
|
|
320
323
|
|
321
324
|
threads = @scheduler.work_threads
|
322
325
|
|
323
|
-
cur = threads.size
|
324
326
|
vac = threads.select { |t| t[:rufus_scheduler_job] == nil }.size
|
325
|
-
#min = @scheduler.min_work_threads
|
326
|
-
max = @scheduler.max_work_threads
|
327
327
|
que = @scheduler.work_queue.size
|
328
328
|
|
329
|
+
cur = threads.size
|
330
|
+
max = @scheduler.max_work_threads
|
331
|
+
|
329
332
|
start_work_thread if vac - que < 1 && cur < max
|
330
333
|
|
331
334
|
@scheduler.work_queue << [ self, time ]
|
@@ -617,11 +620,6 @@ module Rufus
|
|
617
620
|
set_next_time(nil)
|
618
621
|
end
|
619
622
|
|
620
|
-
def frequency
|
621
|
-
|
622
|
-
@cron_line.frequency
|
623
|
-
end
|
624
|
-
|
625
623
|
def brute_frequency
|
626
624
|
|
627
625
|
@cron_line.brute_frequency
|
data/rufus-scheduler.gemspec
CHANGED
@@ -30,7 +30,7 @@ Job scheduler for Ruby (at, cron, in and every jobs). Not a replacement for cron
|
|
30
30
|
|
31
31
|
s.required_ruby_version = '>= 1.9'
|
32
32
|
|
33
|
-
s.add_runtime_dependency 'fugit', '~> 1.1', '>= 1.1.
|
33
|
+
s.add_runtime_dependency 'fugit', '~> 1.1', '>= 1.1.4'
|
34
34
|
|
35
35
|
s.add_development_dependency 'rspec', '~> 3.7'
|
36
36
|
s.add_development_dependency 'chronic', '~> 0.10'
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rufus-scheduler
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 3.5.
|
4
|
+
version: 3.5.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- John Mettraux
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2018-
|
11
|
+
date: 2018-07-20 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: fugit
|
@@ -19,7 +19,7 @@ dependencies:
|
|
19
19
|
version: '1.1'
|
20
20
|
- - ">="
|
21
21
|
- !ruby/object:Gem::Version
|
22
|
-
version: 1.1.
|
22
|
+
version: 1.1.4
|
23
23
|
type: :runtime
|
24
24
|
prerelease: false
|
25
25
|
version_requirements: !ruby/object:Gem::Requirement
|
@@ -29,7 +29,7 @@ dependencies:
|
|
29
29
|
version: '1.1'
|
30
30
|
- - ">="
|
31
31
|
- !ruby/object:Gem::Version
|
32
|
-
version: 1.1.
|
32
|
+
version: 1.1.4
|
33
33
|
- !ruby/object:Gem::Dependency
|
34
34
|
name: rspec
|
35
35
|
requirement: !ruby/object:Gem::Requirement
|
@@ -66,8 +66,8 @@ executables: []
|
|
66
66
|
extensions: []
|
67
67
|
extra_rdoc_files: []
|
68
68
|
files:
|
69
|
-
- CHANGELOG.
|
70
|
-
- CREDITS.
|
69
|
+
- CHANGELOG.md
|
70
|
+
- CREDITS.md
|
71
71
|
- LICENSE.txt
|
72
72
|
- Makefile
|
73
73
|
- README.md
|
@@ -98,7 +98,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
98
98
|
version: '0'
|
99
99
|
requirements: []
|
100
100
|
rubyforge_project: rufus
|
101
|
-
rubygems_version: 2.
|
101
|
+
rubygems_version: 2.5.2.3
|
102
102
|
signing_key:
|
103
103
|
specification_version: 4
|
104
104
|
summary: job scheduler for Ruby (at, cron, in and every jobs)
|