nexaas-async-collector 1.2.1 → 1.2.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
2
  SHA1:
3
- metadata.gz: cc0fe3c2a14aab25aa3d4f763b36546e54e7c096
4
- data.tar.gz: 352b0aa010e04055d7eaa4baf95915f295135bac
3
+ metadata.gz: 8d6262f078636b043ae567b9f2e0e9318b86b80c
4
+ data.tar.gz: 85abf3a76680a3194b366fc6de0459cd86d65142
5
5
  SHA512:
6
- metadata.gz: c5dc494af6c393b9f7b897c90d70eae298d78ec91f5e329a8a0fae7df8eb90e749cb34e1de30d4f254e7e4bf6587601b602690e7ca639964b824c40ea39508a0
7
- data.tar.gz: 53111fa3a1d2fb66dc29ddf7451b2be66dd6ac54933fb0fd5e4f1a388b5ba6b635078938fbb5d4146d7c8b57dbc8d0b862e09f1790b2011a6602b7e391f75f69
6
+ metadata.gz: 4579d88011523cb251fa330a11cd07db1d357430148daed76cd61c49b3c9d2131844e463191cf28e6c044974d74b1e6dcdc255e6804f61dca6e17bfc04106efb
7
+ data.tar.gz: 907207719835d0f6589ecdbafbe248d98e24e9f03b1c6dc6629c885cd3a0b6db32a30d0ebb4432e6ce1c0b52f864b37f3a678a09d8e6a5d9d5fbb88c7c245af3
@@ -1,4 +1,3 @@
1
- require 'redis-namespace'
2
1
  require 'sidekiq'
3
2
  require "nexaas/async/collector/engine"
4
3
  require "nexaas/async/collector/in_memory_storage"
@@ -3,26 +3,24 @@ module Nexaas
3
3
  module Collector
4
4
  class InMemoryStorage
5
5
 
6
- attr_reader :connection, :namespace
7
-
8
- def initialize
9
- @connection ||= Redis.new(url: redis_url)
10
- @namespace ||= Redis::Namespace.new(redis_namespace, redis: connection) if redis_namespace
11
- end
12
-
13
6
  def get(key)
14
- storage.get(key)
7
+ Sidekiq.redis_pool.with do |connection|
8
+ connection.get(namespaced_key(key))
9
+ end
15
10
  end
16
11
 
17
12
  def set(key, value, expiration=nil)
18
- storage.set(key, value)
19
- storage.expire(key, expiration) if expiration
13
+ Sidekiq.redis_pool.with do |connection|
14
+ key = namespaced_key(key)
15
+ connection.set(key, value)
16
+ connection.expire(key, expiration) if expiration
17
+ end
20
18
  end
21
19
 
22
20
  private
23
21
 
24
- def storage
25
- @namespace || @connection
22
+ def namespaced_key(key)
23
+ "#{redis_namespace}:#{key}"
26
24
  end
27
25
 
28
26
  def redis_url
@@ -1,7 +1,7 @@
1
1
  module Nexaas
2
2
  module Async
3
3
  module Collector
4
- VERSION = '1.2.1'
4
+ VERSION = '1.2.2'
5
5
  end
6
6
  end
7
7
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: nexaas-async-collector
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.2.1
4
+ version: 1.2.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Eduardo Hertz
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2017-06-28 00:00:00.000000000 Z
11
+ date: 2017-07-13 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails
@@ -38,20 +38,6 @@ dependencies:
38
38
  - - "~>"
39
39
  - !ruby/object:Gem::Version
40
40
  version: '4.2'
41
- - !ruby/object:Gem::Dependency
42
- name: redis-namespace
43
- requirement: !ruby/object:Gem::Requirement
44
- requirements:
45
- - - ">="
46
- - !ruby/object:Gem::Version
47
- version: 1.5.2
48
- type: :runtime
49
- prerelease: false
50
- version_requirements: !ruby/object:Gem::Requirement
51
- requirements:
52
- - - ">="
53
- - !ruby/object:Gem::Version
54
- version: 1.5.2
55
41
  - !ruby/object:Gem::Dependency
56
42
  name: rspec
57
43
  requirement: !ruby/object:Gem::Requirement