Hello community, here is the log from the commit of package rubygem-timers for openSUSE:Factory checked in at 2019-06-19 21:01:23 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/rubygem-timers (Old) and /work/SRC/openSUSE:Factory/.rubygem-timers.new.4811 (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "rubygem-timers" Wed Jun 19 21:01:23 2019 rev:5 rq:706030 version:4.3.0 Changes: -------- --- /work/SRC/openSUSE:Factory/rubygem-timers/rubygem-timers.changes 2018-11-26 10:36:46.888573030 +0100 +++ /work/SRC/openSUSE:Factory/.rubygem-timers.new.4811/rubygem-timers.changes 2019-06-19 21:01:24.630138997 +0200 @@ -1,0 +2,6 @@ +Sat Mar 2 15:41:29 UTC 2019 - Stephan Kulow <[email protected]> + +- updated to version 4.3.0 + no changelog found + +------------------------------------------------------------------- Old: ---- timers-4.2.0.gem New: ---- timers-4.3.0.gem ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ rubygem-timers.spec ++++++ --- /var/tmp/diff_new_pack.TkG4CE/_old 2019-06-19 21:01:25.314139571 +0200 +++ /var/tmp/diff_new_pack.TkG4CE/_new 2019-06-19 21:01:25.314139571 +0200 @@ -1,7 +1,7 @@ # # spec file for package rubygem-timers # -# Copyright (c) 2018 SUSE LINUX GmbH, Nuernberg, Germany. +# Copyright (c) 2019 SUSE LINUX GmbH, Nuernberg, Germany. # # All modifications and additions to the file contributed by third parties # remain the property of their copyright owners, unless otherwise agreed @@ -24,7 +24,7 @@ # Name: rubygem-timers -Version: 4.2.0 +Version: 4.3.0 Release: 0 %define mod_name timers %define mod_full_name %{mod_name}-%{version} ++++++ timers-4.2.0.gem -> timers-4.3.0.gem ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/.editorconfig new/.editorconfig --- old/.editorconfig 1970-01-01 01:00:00.000000000 +0100 +++ new/.editorconfig 2019-01-21 04:05:25.000000000 +0100 @@ -0,0 +1,6 @@ +root = true + +[*] +indent_style = tab +indent_size = 2 + diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/.travis.yml new/.travis.yml --- old/.travis.yml 2018-11-06 03:27:38.000000000 +0100 +++ new/.travis.yml 2019-01-21 04:05:25.000000000 +0100 @@ -1,5 +1,4 @@ language: ruby -sudo: false dist: xenial cache: bundler @@ -10,10 +9,12 @@ - rvm: 2.5 - rvm: 2.6 - rvm: jruby-head + env: JRUBY_OPTS="--debug -X+O" - rvm: truffleruby - rvm: ruby-head - rvm: rbx-3 allow_failures: - rvm: ruby-head + - rvm: jruby-head - rvm: rbx-3 - rvm: truffleruby diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Gemfile new/Gemfile --- old/Gemfile 2018-11-06 03:27:38.000000000 +0100 +++ new/Gemfile 2019-01-21 04:05:25.000000000 +0100 @@ -8,8 +8,8 @@ group :test do gem 'benchmark-ips' - gem "ruby-prof", platform: :mri - gem 'simplecov' - gem 'coveralls' + gem "ruby-prof", platform: :mri + gem 'simplecov', platform: :mri + gem 'coveralls', platform: :mri end Binary files old/checksums.yaml.gz and new/checksums.yaml.gz differ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/lib/timers/events.rb new/lib/timers/events.rb --- old/lib/timers/events.rb 2018-11-06 03:27:38.000000000 +0100 +++ new/lib/timers/events.rb 2019-01-21 04:05:25.000000000 +0100 @@ -32,10 +32,14 @@ @callback.nil? end - def >(other) + def > other @time > other.to_f end + def >= other + @time >= other.to_f + end + def to_f @time end @@ -50,22 +54,22 @@ # A sequence of handles, maintained in sorted order, future to present. # @sequence.last is the next event to be fired. @sequence = [] + @queue = [] end # Add an event at the given time. def schedule(time, callback) handle = Handle.new(time.to_f, callback) - - index = bisect_left(@sequence, handle) - - # Maintain sorted order, O(logN) insertion time. - @sequence.insert(index, handle) - - handle + + @queue << handle + + return handle end # Returns the first non-cancelled handle. def first + merge! + while (handle = @sequence.last) return handle unless handle.cancelled? @sequence.pop @@ -74,33 +78,44 @@ # Returns the number of pending (possibly cancelled) events. def size - @sequence.size + @sequence.size + @queue.size end # Fire all handles for which Handle#time is less than the given time. def fire(time) - pop(time).reverse_each do |handle| + merge! + + while handle = @sequence.last and handle.time <= time + @sequence.pop handle.fire(time) end end private - # Efficiently take k handles for which Handle#time is less than the given - # time. - def pop(time) - index = bisect_left(@sequence, time) - - @sequence.pop(@sequence.size - index) + def merge! + while handle = @queue.pop + next if handle.cancelled? + + index = bisect_right(@sequence, handle) + + if current_handle = @sequence[index] and current_handle.cancelled? + # puts "Replacing handle at index: #{index} due to cancellation in array containing #{@sequence.size} item(s)." + @sequence[index] = handle + else + # puts "Inserting handle at index: #{index} in array containing #{@sequence.size} item(s)." + @sequence.insert(index, handle) + end + end end - # Return the left-most index where to insert item e, in a list a, assuming + # Return the right-most index where to insert item e, in a list a, assuming # a is sorted in descending order. - def bisect_left(a, e, l = 0, u = a.length) + def bisect_right(a, e, l = 0, u = a.length) while l < u m = l + (u - l).div(2) - if a[m] > e + if a[m] >= e l = m + 1 else u = m diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/lib/timers/group.rb new/lib/timers/group.rb --- old/lib/timers/group.rb 2018-11-06 03:27:38.000000000 +0100 +++ new/lib/timers/group.rb 2019-01-21 04:05:25.000000000 +0100 @@ -81,7 +81,7 @@ sleep interval end end - + fire end diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/lib/timers/timer.rb new/lib/timers/timer.rb --- old/lib/timers/timer.rb 2018-11-06 03:27:38.000000000 +0100 +++ new/lib/timers/timer.rb 2019-01-21 04:05:25.000000000 +0100 @@ -75,6 +75,7 @@ end # Reset this timer. Do not call while paused. + # @param offset [Numeric] the duration to add to the timer. def reset(offset = @group.current_offset) # This logic allows us to minimise the interaction with @group.timers. # A timer with a handle is always registered with the group. @@ -100,7 +101,7 @@ @offset = offset end - @block.call(offset) + @block.call(offset, self) cancel unless recurring end diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/lib/timers/version.rb new/lib/timers/version.rb --- old/lib/timers/version.rb 2018-11-06 03:27:38.000000000 +0100 +++ new/lib/timers/version.rb 2019-01-21 04:05:25.000000000 +0100 @@ -6,5 +6,5 @@ # module Timers - VERSION = "4.2.0" + VERSION = "4.3.0" end diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/metadata new/metadata --- old/metadata 2018-11-06 03:27:38.000000000 +0100 +++ new/metadata 2019-01-21 04:05:25.000000000 +0100 @@ -1,7 +1,7 @@ --- !ruby/object:Gem::Specification name: timers version: !ruby/object:Gem::Version - version: 4.2.0 + version: 4.3.0 platform: ruby authors: - Samuel Williams @@ -9,22 +9,22 @@ autorequire: bindir: bin cert_chain: [] -date: 2018-11-06 00:00:00.000000000 Z +date: 2019-01-21 00:00:00.000000000 Z dependencies: - !ruby/object:Gem::Dependency name: bundler requirement: !ruby/object:Gem::Requirement requirements: - - - "~>" + - - ">=" - !ruby/object:Gem::Version - version: '1.3' + version: '0' type: :development prerelease: false version_requirements: !ruby/object:Gem::Requirement requirements: - - - "~>" + - - ">=" - !ruby/object:Gem::Version - version: '1.3' + version: '0' - !ruby/object:Gem::Dependency name: rspec requirement: !ruby/object:Gem::Requirement @@ -62,6 +62,7 @@ extensions: [] extra_rdoc_files: [] files: +- ".editorconfig" - ".gitignore" - ".rspec" - ".travis.yml" @@ -103,8 +104,7 @@ - !ruby/object:Gem::Version version: '0' requirements: [] -rubyforge_project: -rubygems_version: 2.7.7 +rubygems_version: 3.0.1 signing_key: specification_version: 4 summary: Pure Ruby one-shot and periodic timers diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/spec/spec_helper.rb new/spec/spec_helper.rb --- old/spec/spec_helper.rb 2018-11-06 03:27:38.000000000 +0100 +++ new/spec/spec_helper.rb 2019-01-21 04:05:25.000000000 +0100 @@ -25,8 +25,10 @@ end end -require "bundler/setup" -require "timers" +require 'bundler/setup' +Bundler.require(:test) + +require 'timers' RSpec.configure do |config| # Enable flags like --only-failures and --next-failure diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/spec/timers/performance_spec.rb new/spec/timers/performance_spec.rb --- old/spec/timers/performance_spec.rb 2018-11-06 03:27:38.000000000 +0100 +++ new/spec/timers/performance_spec.rb 2019-01-21 04:05:25.000000000 +0100 @@ -6,7 +6,6 @@ # require "spec_helper" -require "ruby-prof" unless RUBY_PLATFORM =~ /java|rbx/ # Event based timers: diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/spec/timers/strict_spec.rb new/spec/timers/strict_spec.rb --- old/spec/timers/strict_spec.rb 2018-11-06 03:27:38.000000000 +0100 +++ new/spec/timers/strict_spec.rb 2019-01-21 04:05:25.000000000 +0100 @@ -24,18 +24,16 @@ expect(fired - start_offset).to be_within(quantum).of(iterations * quantum) end - it "should only fire once" do - fired = :not_fired_yet + it "should only fire 0-interval timer once per iteration" do count = 0 - + start_offset = subject.current_offset - Timers::Timer.new(subject, 0, :strict, start_offset) do |offset| - fired = offset + Timers::Timer.new(subject, 0, :strict, start_offset) do |offset, timer| count += 1 end - + subject.wait - + expect(count).to be == 1 end end diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/timers.gemspec new/timers.gemspec --- old/timers.gemspec 2018-11-06 03:27:38.000000000 +0100 +++ new/timers.gemspec 2019-01-21 04:05:25.000000000 +0100 @@ -27,7 +27,7 @@ spec.required_ruby_version = '>= 2.2.1' - spec.add_development_dependency "bundler", "~> 1.3" + spec.add_development_dependency "bundler" spec.add_development_dependency "rspec", "~> 3.6" spec.add_development_dependency "rake" end
