diff --git a/.travis.yml b/.travis.yml index 4fce134a7..1df3f080a 100644 --- a/.travis.yml +++ b/.travis.yml @@ -8,7 +8,7 @@ rvm: - 2.5 - 2.6 - 2.7 - - jruby-9.0.5.0 + - jruby-9.2.21.0 jdk: - openjdk8 env: diff --git a/Gemfile.lock b/Gemfile.lock index 62622f396..3e0ee5e77 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -2,7 +2,8 @@ PATH remote: . specs: cassandra-driver (3.2.5) - ione (~> 1.2) + ione (~> 1.2.5) + monotime (~> 0.7) GEM remote: https://rubygems.org/ @@ -40,12 +41,13 @@ GEM ffi (1.9.25) ffi (1.9.25-java) gherkin (3.2.0) - ione (1.2.4) + ione (1.2.5) json (1.8.6) json (1.8.6-java) lz4-ruby (0.3.3) lz4-ruby (0.3.3-java) minitest (4.7.5) + monotime (0.7.1) multi_json (1.11.2) multi_test (0.1.2) os (0.9.6) diff --git a/cassandra-driver.gemspec b/cassandra-driver.gemspec index bd2624b50..7230f571c 100644 --- a/cassandra-driver.gemspec +++ b/cassandra-driver.gemspec @@ -30,7 +30,8 @@ Gem::Specification.new do |s| s.files << 'ext/cassandra_murmur3/cassandra_murmur3.c' end - s.add_runtime_dependency 'ione', '~> 1.2' + s.add_runtime_dependency 'ione', '~> 1.2.5' + s.add_runtime_dependency 'monotime', '~> 0.7' s.add_development_dependency 'bundler', '~> 1.6' s.add_development_dependency 'rake', '~> 13.0' diff --git a/lib/cassandra/driver.rb b/lib/cassandra/driver.rb index 096d8bacc..fa6448183 100644 --- a/lib/cassandra/driver.rb +++ b/lib/cassandra/driver.rb @@ -28,7 +28,8 @@ def self.let(name, &block) define_method(:"#{name}=") { |object| @instances[name] = object } end - let(:io_reactor) { Ione::Io::IoReactor.new } + let(:monotonic_clock) { Cassandra::Util::MonoClock::new } + let(:io_reactor) { Ione::Io::IoReactor.new(clock: monotonic_clock) } let(:cluster_registry) { Cluster::Registry.new(logger) } let(:cluster_schema) { Cluster::Schema.new } let(:cluster_metadata) do diff --git a/lib/cassandra/util.rb b/lib/cassandra/util.rb index 167830774..d40217331 100644 --- a/lib/cassandra/util.rb +++ b/lib/cassandra/util.rb @@ -19,6 +19,16 @@ module Cassandra # @private module Util + class MonoClock + def initialize + @start = Monotime::Instant.now + end + + def now + @start.elapsed.to_secs + end + end + module_function def encode_hash(hash, io = StringIO.new)