time_bandits 0.12.7 → 0.13.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 4b8b86f7d1fd439347f33ce1a814afe78f6bb4b81f287821d1cafa710d685cc7
4
- data.tar.gz: bd4914bd9edc10e9af70e9d642de6f4f29a6718f2405121f1d7e64155e90920b
3
+ metadata.gz: b008edd801936f7287a5cfd453ed13af7c883ec9780731e78a490da3ddaa3c6f
4
+ data.tar.gz: f062f276b88df3b380e8dc6b9ddda4c81e164c878f6e5867167e43bf9155ab06
5
5
  SHA512:
6
- metadata.gz: 2be85317edc8af9c48c7aa319c6725bc1fad3f734190a83742995926c9bb90f82ce88d2c9f87abea92c6e96f85235176a896ea7449fd8ed03615dd7c2ae85a57
7
- data.tar.gz: 7566807416012598e58e9528a8196fba0bfefa9841a32052792a23070b9cae8e98844455f73edd25644ec09eca12f3e4a895010347724e5cc9fffd184f9f7413
6
+ metadata.gz: 9c60df11a4defd9f8764d267575b72918077fd51f0380a3f655af5f6f5b9b7c9e15a43621869f6f34623ee859d04feb35f91427fd60a50d33ec4fae97e6a8196
7
+ data.tar.gz: f862c5684068b9ba85bfac90a4472639a3e3c72f1b0ea63e83824f4b635bbb8e853e79706015ceb633c12ad636bdcdc7c8bff2821b4f894846bcd61def5da757
data/Appraisals CHANGED
@@ -7,8 +7,11 @@ appraisals.insert(0, "5.2.6") if Gem::Version.new(RUBY_VERSION) < Gem::Version.n
7
7
  appraisals << "7.0.2.3" if Gem::Version.new(RUBY_VERSION) >= Gem::Version.new("2.7.0")
8
8
 
9
9
  appraisals.each do |rails_version|
10
- appraise "activesupport-#{rails_version}" do
11
- gem "activesupport", rails_version
12
- gem "activerecord", rails_version
10
+ %w(4.0 5.0).each do |redis_version|
11
+ appraise "activesupport-#{rails_version}-redis-#{redis_version}" do
12
+ gem "redis", "~> #{redis_version}"
13
+ gem "activesupport", rails_version
14
+ gem "activerecord", rails_version
15
+ end
13
16
  end
14
17
  end
data/CHANGELOG.md CHANGED
@@ -1,6 +1,9 @@
1
1
  # CHANGELOG
2
2
 
3
- ## Version 0.12.6
3
+ ## 0.13.0
4
+ * Support redis 5.0.
5
+
6
+ ## Version 0.12.7
4
7
  * logging start time requires a real time, not a monotonic clock
5
8
 
6
9
  ## Version 0.12.6
data/Gemfile CHANGED
@@ -2,3 +2,5 @@ source "https://rubygems.org"
2
2
 
3
3
  # Specify your gem's dependencies in time_bandits.gemspec
4
4
  gemspec
5
+
6
+ gem "hiredis-client"
data/docker-compose.yml CHANGED
@@ -17,7 +17,7 @@ services:
17
17
 
18
18
  redis:
19
19
  container_name: redis
20
- image: redis:5.0
20
+ image: redis:6.0
21
21
  ports:
22
22
  - "6379:6379"
23
23
 
@@ -1,12 +1,36 @@
1
1
  require 'redis'
2
- class Redis
3
- class Client
4
- alias :old_logging :logging
5
2
 
6
- def logging(commands, &block)
7
- ActiveSupport::Notifications.instrument('request.redis', commands: commands) do
8
- old_logging(commands, &block)
3
+ if Redis::VERSION < "5.0"
4
+
5
+ class Redis
6
+ class Client
7
+ alias :old_logging :logging
8
+
9
+ def logging(commands, &block)
10
+ ActiveSupport::Notifications.instrument('request.redis', commands: commands) do
11
+ old_logging(commands, &block)
12
+ end
13
+ end
14
+ end
15
+ end
16
+
17
+ else
18
+
19
+ module TimeBandits
20
+ module RedisInstrumentation
21
+ def call(command, redis_config)
22
+ ActiveSupport::Notifications.instrument("request.redis", commands: [command]) do
23
+ super
24
+ end
25
+ end
26
+
27
+ def call_pipelined(commands, redis_config)
28
+ ActiveSupport::Notifications.instrument("request.redis", commands: commands) do
29
+ super
30
+ end
9
31
  end
10
32
  end
11
33
  end
34
+ RedisClient.register(TimeBandits::RedisInstrumentation)
35
+
12
36
  end
@@ -16,7 +16,7 @@ module TimeBandits
16
16
  def request(event)
17
17
  i = Redis.instance
18
18
  i.time += event.duration
19
- i.calls += 1 #count redis round trips, not calls
19
+ i.calls += 1 # count redis round trips, not calls
20
20
 
21
21
  return unless logger.debug?
22
22
 
@@ -1,3 +1,3 @@
1
1
  module TimeBandits
2
- VERSION = "0.12.7"
2
+ VERSION = "0.13.0"
3
3
  end
@@ -54,10 +54,10 @@ class RedisTest < Test::Unit::TestCase
54
54
  private
55
55
  def pipelined_work(type = :pipelined)
56
56
  TimeBandits.reset
57
- @redis.send(type) do
58
- @redis.get("foo")
59
- @redis.set("bar", 1)
60
- @redis.hgetall("baz")
57
+ @redis.send(type) do |transaction|
58
+ transaction.get("foo")
59
+ transaction.set("bar", 1)
60
+ transaction.hgetall("baz")
61
61
  end
62
62
  end
63
63
 
data/time_bandits.gemspec CHANGED
@@ -33,7 +33,7 @@ Gem::Specification.new do |s|
33
33
  s.add_development_dependency("mocha")
34
34
  s.add_development_dependency("mysql2")
35
35
  s.add_development_dependency("rake")
36
- s.add_development_dependency("redis", "< 5.0")
36
+ s.add_development_dependency("redis")
37
37
  s.add_development_dependency("sequel")
38
38
  s.add_development_dependency("activerecord")
39
39
  s.add_development_dependency("beetle", ">= 3.4.1")
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: time_bandits
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.12.7
4
+ version: 0.13.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Stefan Kaes
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2022-08-31 00:00:00.000000000 Z
11
+ date: 2022-09-02 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: thread_variables
@@ -168,16 +168,16 @@ dependencies:
168
168
  name: redis
169
169
  requirement: !ruby/object:Gem::Requirement
170
170
  requirements:
171
- - - "<"
171
+ - - ">="
172
172
  - !ruby/object:Gem::Version
173
- version: '5.0'
173
+ version: '0'
174
174
  type: :development
175
175
  prerelease: false
176
176
  version_requirements: !ruby/object:Gem::Requirement
177
177
  requirements:
178
- - - "<"
178
+ - - ">="
179
179
  - !ruby/object:Gem::Version
180
- version: '5.0'
180
+ version: '0'
181
181
  - !ruby/object:Gem::Dependency
182
182
  name: sequel
183
183
  requirement: !ruby/object:Gem::Requirement