rufus-scheduler 3.5.1 → 3.5.2

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
- SHA1:
3
- metadata.gz: f4e266cabe7da6408e8646fbedabd788ad74188f
4
- data.tar.gz: bf8312e05826c8f7aeb150c4f69c874d446f8c55
2
+ SHA256:
3
+ metadata.gz: cc94e118313d64c54f5690f3c2a144c21f7b56c0719c36a0642982f468469750
4
+ data.tar.gz: 52f2bf8923744d67938cbf0dfa764d8e6304fab512188c916505cf342203ec54
5
5
  SHA512:
6
- metadata.gz: 14064eb823dd4efcdf5bcc3cf53de39307184237d1ea95ec826f79fc3398d74ff76edf3206c7bdf113895b9c82d9a27899b4b50dd633fcb56155a36fbec7f8b6
7
- data.tar.gz: dc32167e6b96204a8aa377b8a8c084518ad406eb3b02b8a2ebc7e26698ab3657a4fd6c702093bf7facae54defc0e786a0dd0e69059a653bbfeda2994007309ac
6
+ metadata.gz: f02d8f20e5acaeaa27a8c9e0895e8c1fc5ba534c2c228e683ac36042e32f5306cade78225dc8335e38fab8f724a6edf23b0196d5506d53c989af0e88e65cdbef
7
+ data.tar.gz: 9aa6c0211441f60d3b326b6d35abde28dbe01558830288b3a4f7d2aed9523e6bf690345ca39656dafc976dec3a658b435735ea8f568cc02856861e074de2f226
@@ -2,6 +2,12 @@
2
2
  # CHANGELOG.md
3
3
 
4
4
 
5
+ ### rufus-scheduler 3.5.2 - released 2018-08-01
6
+
7
+ * Use Fugit::Cron#rough_frequency
8
+ * Improve Job#check_frequency performance, gh-276, @drcapulet
9
+
10
+
5
11
  ### rufus-scheduler 3.5.1 - released 2018-07-20
6
12
 
7
13
  * Upgrade fugit to 1.1.4 (with out of DST issue fix)
data/CREDITS.md CHANGED
@@ -4,10 +4,11 @@
4
4
 
5
5
  ## Contributors
6
6
 
7
- * Vais Salikhov (https://github.com/vais) - many document clarifications
8
- * Wes McNamee (https://github.com/ghostsquad) - let #schedule accept a CronLine
9
- * Joe Rafaniello (https://github.com/jrafanie) - Travis Ruby 2.4.1
10
- * Benjamin Fleischer (https://github.com/bf4) - ZoTime#subtract
7
+ * Alex Coomans (https://github.com/drcapulet) gh-276 freq check pref improvement
8
+ * Vais Salikhov (https://github.com/vais) many document clarifications
9
+ * Wes McNamee (https://github.com/ghostsquad) let #schedule accept a CronLine
10
+ * Joe Rafaniello (https://github.com/jrafanie) Travis Ruby 2.4.1
11
+ * Benjamin Fleischer (https://github.com/bf4) ZoTime#subtract
11
12
  * Sam Rowe (https://github.com/riddley) gh-240 timezone for Debian
12
13
  * Daniel Rodgers-Pryor (https://github.com/djrodgerspryor), gh-238 fix ZooKeeper example
13
14
  * Cody Cutrer (https://github.com/ccutrer) gh-232 is_a?(Fixnum) replacement
data/README.md CHANGED
@@ -46,6 +46,9 @@ end
46
46
  scheduler.every '3h' do
47
47
  # do something every 3 hours
48
48
  end
49
+ scheduler.every '3h10m' do
50
+ # do something every 3 hours and 10 minutes
51
+ end
49
52
 
50
53
  scheduler.cron '5 0 * * *' do
51
54
  # do something every day, five minutes after midnight
@@ -11,7 +11,7 @@ module Rufus
11
11
 
12
12
  class Scheduler
13
13
 
14
- VERSION = '3.5.1'
14
+ VERSION = '3.5.2'
15
15
 
16
16
  EoTime = ::EtOrbi::EoTime
17
17
 
@@ -615,36 +615,7 @@ module Rufus
615
615
  end
616
616
 
617
617
  job = job_class.new(self, t, opts, block || callable)
618
-
619
- #fail ArgumentError.new(
620
- # "job frequency (#{job.frequency}) is higher than " +
621
- # "scheduler frequency (#{@frequency})"
622
- #) if job.respond_to?(:frequency) && job.frequency < @frequency
623
- #
624
- # This was expensive
625
-
626
- if (
627
- ! job.is_a?(Rufus::Scheduler::IntervalJob) &&
628
- job.methods.include?(:next_time_from)
629
- ) then
630
-
631
- nts = (1..365)
632
- .inject([ job.send(:next_time_from, EtOrbi.now) ]) { |a, i|
633
- a << job.send(:next_time_from, a.last); a }
634
- deltas = []; prev = nts.shift
635
- while (nt = nts.shift); deltas << (nt - prev).to_f; prev = nt; end
636
-
637
- deltas = deltas[1..-1] \
638
- if opts.keys.find { |k| k.to_s.match(/\Afirst/) }
639
- #
640
- # do not consider the first delta if there is a first, first_at,
641
- # or first_in involved
642
-
643
- fail ArgumentError.new(
644
- "job frequency (~max #{deltas.min}s) is higher than " +
645
- "scheduler frequency (#{@frequency})"
646
- ) if deltas.min < @frequency * 0.9
647
- end
618
+ job.check_frequency
648
619
 
649
620
  @jobs.push(job)
650
621
 
@@ -95,6 +95,14 @@ module Rufus
95
95
 
96
96
  alias job_id id
97
97
 
98
+ # Will fail with an ArgumentError if the job frequency is higher than
99
+ # the scheduler frequency.
100
+ #
101
+ def check_frequency
102
+
103
+ # this parent implementation never fails
104
+ end
105
+
98
106
  def trigger(time)
99
107
 
100
108
  @previous_time = @next_time
@@ -543,6 +551,14 @@ module Rufus
543
551
  set_next_time(nil)
544
552
  end
545
553
 
554
+ def check_frequency
555
+
556
+ fail ArgumentError.new(
557
+ "job frequency (#{@frequency}s) is higher than " +
558
+ "scheduler frequency (#{@scheduler.frequency}s)"
559
+ ) if @frequency < @scheduler.frequency
560
+ end
561
+
546
562
  protected
547
563
 
548
564
  def set_next_time(trigger_time, is_post=false)
@@ -620,11 +636,31 @@ module Rufus
620
636
  set_next_time(nil)
621
637
  end
622
638
 
639
+ def check_frequency
640
+
641
+ return if @scheduler.frequency <= 1
642
+ #
643
+ # The minimum time delta in a cron job is 1 second, so if the
644
+ # scheduler frequency is less than that, no worries.
645
+
646
+ f = @cron_line.rough_frequency
647
+
648
+ fail ArgumentError.new(
649
+ "job frequency (min ~#{f}s) is higher than " +
650
+ "scheduler frequency (#{@scheduler.frequency}s)"
651
+ ) if f < @scheduler.frequency
652
+ end
653
+
623
654
  def brute_frequency
624
655
 
625
656
  @cron_line.brute_frequency
626
657
  end
627
658
 
659
+ def rough_frequency
660
+
661
+ @cron_line.rough_frequency
662
+ end
663
+
628
664
  protected
629
665
 
630
666
  def set_next_time(trigger_time, is_post=false)
@@ -19,6 +19,16 @@ Gem::Specification.new do |s|
19
19
  Job scheduler for Ruby (at, cron, in and every jobs). Not a replacement for crond.
20
20
  }.strip
21
21
 
22
+ s.metadata = {
23
+ 'changelog_uri' => s.homepage + '/blob/master/CHANGELOG.md',
24
+ 'bug_tracker_uri' => s.homepage + '/issues',
25
+ 'homepage_uri' => s.homepage,
26
+ 'source_code_uri' => s.homepage,
27
+ #'wiki_uri' => s.homepage + '/flor/wiki',
28
+ #'documentation_uri' => s.homepage + '/tree/master/doc',
29
+ #'mailing_list_uri' => 'https://groups.google.com/forum/#!forum/floraison',
30
+ }
31
+
22
32
  #s.files = `git ls-files`.split("\n")
23
33
  s.files = Dir[
24
34
  'README.{md,txt}',
@@ -30,7 +40,7 @@ Job scheduler for Ruby (at, cron, in and every jobs). Not a replacement for cron
30
40
 
31
41
  s.required_ruby_version = '>= 1.9'
32
42
 
33
- s.add_runtime_dependency 'fugit', '~> 1.1', '>= 1.1.4'
43
+ s.add_runtime_dependency 'fugit', '~> 1.1', '>= 1.1.5'
34
44
 
35
45
  s.add_development_dependency 'rspec', '~> 3.7'
36
46
  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.1
4
+ version: 3.5.2
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-07-20 00:00:00.000000000 Z
11
+ date: 2018-07-31 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.4
22
+ version: 1.1.5
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.4
32
+ version: 1.1.5
33
33
  - !ruby/object:Gem::Dependency
34
34
  name: rspec
35
35
  requirement: !ruby/object:Gem::Requirement
@@ -81,7 +81,11 @@ files:
81
81
  homepage: http://github.com/jmettraux/rufus-scheduler
82
82
  licenses:
83
83
  - MIT
84
- metadata: {}
84
+ metadata:
85
+ changelog_uri: http://github.com/jmettraux/rufus-scheduler/blob/master/CHANGELOG.md
86
+ bug_tracker_uri: http://github.com/jmettraux/rufus-scheduler/issues
87
+ homepage_uri: http://github.com/jmettraux/rufus-scheduler
88
+ source_code_uri: http://github.com/jmettraux/rufus-scheduler
85
89
  post_install_message:
86
90
  rdoc_options: []
87
91
  require_paths:
@@ -98,7 +102,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
98
102
  version: '0'
99
103
  requirements: []
100
104
  rubyforge_project: rufus
101
- rubygems_version: 2.5.2.3
105
+ rubygems_version: 2.7.6
102
106
  signing_key:
103
107
  specification_version: 4
104
108
  summary: job scheduler for Ruby (at, cron, in and every jobs)