salesforce_streamer 0.2.3 → 0.3.0

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
  SHA256:
3
- metadata.gz: f01093a6c7c50146654d2e883853a0217b61cda52de722316afb6a4204f4a34d
4
- data.tar.gz: 89e6790193442a62e72db11ab2f11fa44714ac442b2be327d24dffafbc885028
3
+ metadata.gz: 7e5279cbf060a7998dda26f5b8243f4f7f45a235df437b6e5b43dded0a0db770
4
+ data.tar.gz: fe42569934ea906d2a90426367233918558abf2848be187263af5556ab56ae3e
5
5
  SHA512:
6
- metadata.gz: 8a844ebbf4f791b6075a60d96e54b287ca17fba45f543dadab7c0dafd49999816c6f52288c0f94d06b09c4be1f18eac2af9a7ef966c06fe187d68e0982b0af48
7
- data.tar.gz: 6d6e6e809a0d4be3c78a4a1809b6f22cf0e8a7aa108a391a7b858619fb34a067be6df58463ed447c58d76981ec1d47a1b98786c04cf7a343c2b7582908ae9b5e
6
+ metadata.gz: d3f90343488c893ef58bf82ef39105acaef83283476228d7263f524ca87855dd781212cb8b107786def223c32bfea43d9f299a15bca50e95698c3b733350ad9a
7
+ data.tar.gz: 68467636cccd05ffdd5acc046b32f8f8d5dff0a14b9a72f7bcb18ac102b7664d4bb69538b5613200964f3186b596f345c1c7de83bbf1191a36df811bd825d589
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- salesforce_streamer (0.2.3)
4
+ salesforce_streamer (0.3.0)
5
5
  faye (= 0.8.9)
6
6
  restforce (~> 3.1.0)
7
7
 
@@ -20,26 +20,23 @@ module SalesforceStreamer
20
20
  end
21
21
  end
22
22
 
23
- # Saves the value in a sorted set named by the key
24
- # The score is the ReplayId integer value
23
+ # Saves the value to a key with expiration
25
24
  def record(key, value)
26
25
  return unless key && value
27
26
 
28
27
  key = namespaced_key(key)
29
28
  value = Integer(value)
30
- # The score is the value
31
- connection { |c| c.zadd key, value, value }
29
+ connection { |c| c.setex key, SECONDS_TO_EXPIRE, value }
32
30
  rescue StandardError, TypeError => e
33
31
  Configuration.instance.exception_adapter.call e
34
32
  nil
35
33
  end
36
34
 
37
- # Retrives the highest value in the sorted set
38
35
  def retrieve(key)
39
36
  return unless key
40
37
 
41
38
  key = namespaced_key(key)
42
- value = connection { |c| c.zrevrange(key, START, STOP)&.first }
39
+ value = connection { |c| c.get key }
43
40
  Integer(value) if value
44
41
  rescue StandardError => e
45
42
  Configuration.instance.exception_adapter.call e
@@ -53,6 +50,7 @@ module SalesforceStreamer
53
50
  end
54
51
 
55
52
  NAMESPACE = 'SalesforceStreamer:'
53
+ SECONDS_TO_EXPIRE = 24 * 60 * 60 # 24 hours
56
54
  START = 0
57
55
  STOP = 0
58
56
  end
@@ -12,7 +12,7 @@ module SalesforceStreamer
12
12
 
13
13
  def retrieve(key)
14
14
  Configuration.instance.persistence_adapter&.retrieve(key).tap do |v|
15
- Log.debug { "Retrieved for #{key} #{ v || 'nil' }" }
15
+ Log.debug { "Retrieved for #{key} #{v || 'nil'}" }
16
16
  end
17
17
  end
18
18
  end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module SalesforceStreamer
4
- VERSION = '0.2.3'
4
+ VERSION = '0.3.0'
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: salesforce_streamer
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.3
4
+ version: 0.3.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Scott Serok
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2019-10-18 00:00:00.000000000 Z
11
+ date: 2019-10-29 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler