resque-analytics 0.7.2 → 0.7.3

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
  SHA1:
3
- metadata.gz: 1c46089c87f036feac7d1b6d3b4eb8a34813b2fa
4
- data.tar.gz: 65334c145b6f3cc973fbde9b70f563ede1abdee5
3
+ metadata.gz: 80a830fd368faae5913628a5eb3e4f437b286d6f
4
+ data.tar.gz: 9c2049415189610e3ff353ad858f704358cdd684
5
5
  SHA512:
6
- metadata.gz: 7e4e9355d1c2a1482687951fe6068176165dfebf801bb986433fd99c0afc9450ba0758fb9fef642c3571b45ba1349d2f98fc26ea5d53c94b0cba85d646554ce0
7
- data.tar.gz: a9f11569e26c252cd335d2d13456e82415f46cbce9e5a161eb1227ac70ee8f4a0873654e54084b1a4f54d4a3f3dd6c4a24247837aaefa1e611f2868b4dd7da2d
6
+ metadata.gz: 3d6159e85b1e42f2452d103fa6d9af98ed28c0c8beeffc7b825e839074639dd71109f0f2f27df2544587ed52ded02ed6dd094b0bc8540529fd9653c9a5dd4a0c
7
+ data.tar.gz: 4b9bf5505456d9193f16562eb7704b28abee9e3db3a4a3f29495e3aea020b91075cc21f906156e9405e3acf0f5bcb955e90f39cd2e57ca11c1d71e56f78ade91
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.7.2
1
+ 0.7.3
@@ -52,24 +52,27 @@ module Resque
52
52
  start = Time.now
53
53
  yield
54
54
  total_time = Time.now - start
55
-
56
- Resque.redis.hincrbyfloat(key, field(TOTAL_TIME), total_time)
57
- Resque.redis.expire(key, EXPIRE)
55
+ redis_command("hincrbyfloat", key, field(TOTAL_TIME), total_time)
58
56
  end
59
57
 
60
58
  def after_perform_analytics(*args)
61
- Resque.redis.hincrby(key, field(PERFORMED), 1)
62
- Resque.redis.expire(key, EXPIRE)
59
+ redis_command("hincrby", key, field(PERFORMED))
63
60
  end
64
61
 
65
62
  def on_failure_analytics(error, *args)
66
- Resque.redis.hincrby(key, field(FAILED), 1)
67
- Resque.redis.expire(key, EXPIRE)
63
+ redis_command("hincrby", key, field(FAILED))
68
64
  end
69
65
 
70
66
  def analytics_timestamp(timestamp)
71
- Resque.redis.hincrbyfloat(key, field(WAIT_TIME), Time.now - Time.parse(timestamp))
67
+ redis_command("hincrbyfloat", key, field(WAIT_TIME), Time.now - Time.parse(timestamp))
68
+ end
69
+
70
+ def redis_command(command, key, field, timestamp = 1)
71
+ tries ||= 3
72
+ Resque.redis.send(command, key, field, timestamp)
72
73
  Resque.redis.expire(key, EXPIRE)
74
+ rescue Redis::TimeoutError, Redis::CannotConnectError
75
+ retry if (tries -= 1).nonzero?
73
76
  end
74
77
 
75
78
  end
@@ -2,16 +2,16 @@
2
2
  # DO NOT EDIT THIS FILE DIRECTLY
3
3
  # Instead, edit Jeweler::Tasks in Rakefile, and run 'rake gemspec'
4
4
  # -*- encoding: utf-8 -*-
5
- # stub: resque-analytics 0.7.2 ruby lib
5
+ # stub: resque-analytics 0.7.3 ruby lib
6
6
 
7
7
  Gem::Specification.new do |s|
8
8
  s.name = "resque-analytics"
9
- s.version = "0.7.2"
9
+ s.version = "0.7.3"
10
10
 
11
11
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
12
12
  s.require_paths = ["lib"]
13
13
  s.authors = ["Nir Tzur"]
14
- s.date = "2015-03-01"
14
+ s.date = "2017-01-03"
15
15
  s.description = "Shows Resque jobs key performance indciators over time"
16
16
  s.email = "nir.tzur@samanage.com"
17
17
  s.extra_rdoc_files = [
@@ -31,7 +31,6 @@ Gem::Specification.new do |s|
31
31
  "lib/resque-analytics/server.rb",
32
32
  "lib/resque-analytics/server/views/analytics.erb",
33
33
  "lib/resque/plugins/analytics.rb",
34
- "resque-analytics-0.7.1.gem",
35
34
  "resque-analytics.gemspec"
36
35
  ]
37
36
  s.homepage = "http://github.com/nirtzur/resque-analytics"
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: resque-analytics
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.7.2
4
+ version: 0.7.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Nir Tzur
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-03-01 00:00:00.000000000 Z
11
+ date: 2017-01-03 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: resque
@@ -100,7 +100,6 @@ files:
100
100
  - lib/resque-analytics/server.rb
101
101
  - lib/resque-analytics/server/views/analytics.erb
102
102
  - lib/resque/plugins/analytics.rb
103
- - resque-analytics-0.7.1.gem
104
103
  - resque-analytics.gemspec
105
104
  homepage: http://github.com/nirtzur/resque-analytics
106
105
  licenses:
Binary file