istox 0.1.146 → 0.1.147
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 +4 -4
- data/.idea/.rakeTasks +1 -1
- data/.idea/istox-gem.iml +26 -3
- data/Gemfile.lock +6 -6
- data/lib/istox/helpers/bunny_boot.rb +8 -1
- data/lib/istox/helpers/publisher.rb +2 -2
- data/lib/istox/helpers/redis.rb +6 -4
- data/lib/istox/helpers/remote_model_cache.rb +12 -24
- data/lib/istox/helpers/subscriber.rb +2 -1
- data/lib/istox/version.rb +1 -1
- metadata +3 -3
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 62410937adc037a38505293af9ea88f757b4a41cf3f5b79a1e3fa6965cfb0da6
|
|
4
|
+
data.tar.gz: 3e10782579a06c8eae536aef7cc035cf99a7c771f3544b1652deee5e3e69383a
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 02a49ce44bbf0ebaddfd6a1bdd69a6c6e23339c78aa104550c1bf373db07db1695b7d8055fd34da46f56a50b79ca42cb25970d1a1f2ef4c2dc1af2df86adafa5
|
|
7
|
+
data.tar.gz: 012173f47716a26701cbb4ab6ffa792e3a2f02bdbe9d1afaf572cdd63bd552a5f61a21fe3e3c64154f5a953de5714bca131c5f5dbd9be8998c54c8576d65ccfe
|
data/.idea/.rakeTasks
CHANGED
|
@@ -4,4 +4,4 @@ You are allowed to:
|
|
|
4
4
|
1. Remove rake task
|
|
5
5
|
2. Add existing rake tasks
|
|
6
6
|
To add existing rake tasks automatically delete this file and reload the project.
|
|
7
|
-
--><RakeGroup description="" fullCmd="" taksId="rake" /></Settings>
|
|
7
|
+
--><RakeGroup description="" fullCmd="" taksId="rake"><RakeTask description="Build istox-0.1.130.pre.3.gem into the pkg directory" fullCmd="build" taksId="build" /><RakeTask description="Remove any temporary products" fullCmd="clean" taksId="clean" /><RakeTask description="Remove any generated files" fullCmd="clobber" taksId="clobber" /><RakeTask description="Build and install istox-0.1.130.pre.3.gem into system gems" fullCmd="install" taksId="install" /><RakeGroup description="" fullCmd="" taksId="install"><RakeTask description="Build and install istox-0.1.130.pre.3.gem into system gems without network access" fullCmd="install:local" taksId="local" /></RakeGroup><RakeTask description="Create tag v0.1.130.pre.3 and build and push istox-0.1.130.pre.3.gem to rubygems.org" fullCmd="release[remote]" taksId="release[remote]" /><RakeTask description="Run RSpec code examples" fullCmd="spec" taksId="spec" /><RakeTask description="" fullCmd="default" taksId="default" /><RakeTask description="" fullCmd="release" taksId="release" /><RakeGroup description="" fullCmd="" taksId="release"><RakeTask description="" fullCmd="release:guard_clean" taksId="guard_clean" /><RakeTask description="" fullCmd="release:rubygem_push" taksId="rubygem_push" /><RakeTask description="" fullCmd="release:source_control_push" taksId="source_control_push" /></RakeGroup></RakeGroup></Settings>
|
data/.idea/istox-gem.iml
CHANGED
|
@@ -4,9 +4,32 @@
|
|
|
4
4
|
<shared />
|
|
5
5
|
</component>
|
|
6
6
|
<component name="NewModuleRootManager">
|
|
7
|
-
<content url="file://$MODULE_DIR$"
|
|
8
|
-
|
|
7
|
+
<content url="file://$MODULE_DIR$">
|
|
8
|
+
<excludeFolder url="file://$MODULE_DIR$/vendor" />
|
|
9
|
+
</content>
|
|
10
|
+
<orderEntry type="jdk" jdkName="RVM: ruby-2.5.3" jdkType="RUBY_SDK" />
|
|
9
11
|
<orderEntry type="sourceFolder" forTests="false" />
|
|
10
|
-
<orderEntry type="library"
|
|
12
|
+
<orderEntry type="module-library">
|
|
13
|
+
<library name="tzinfo (vbundled(1.2.6)) [path][gem]" type="rubylib">
|
|
14
|
+
<properties>
|
|
15
|
+
<option name="version" value="4" />
|
|
16
|
+
</properties>
|
|
17
|
+
<CLASSES>
|
|
18
|
+
<root url="file://$MODULE_DIR$/vendor/bundle/ruby/2.5.0/gems/tzinfo-1.2.6/lib" />
|
|
19
|
+
<root url="file://$MODULE_DIR$/vendor/bundle/ruby/2.5.0/gems/tzinfo-1.2.6/test" />
|
|
20
|
+
</CLASSES>
|
|
21
|
+
<SOURCES>
|
|
22
|
+
<root url="file://$MODULE_DIR$/vendor/bundle/ruby/2.5.0/gems/tzinfo-1.2.6/lib" />
|
|
23
|
+
<root url="file://$MODULE_DIR$/vendor/bundle/ruby/2.5.0/gems/tzinfo-1.2.6/test" />
|
|
24
|
+
</SOURCES>
|
|
25
|
+
<excluded>
|
|
26
|
+
<root url="file://$MODULE_DIR$/vendor/bundle/ruby/2.5.0/gems/tzinfo-1.2.6/test" />
|
|
27
|
+
</excluded>
|
|
28
|
+
</library>
|
|
29
|
+
</orderEntry>
|
|
30
|
+
<orderEntry type="library" scope="PROVIDED" name="bundler (v1.17.3, RVM: ruby-2.5.3) [gem]" level="application" />
|
|
31
|
+
<orderEntry type="library" scope="PROVIDED" name="concurrent-ruby (v1.1.6, RVM: ruby-2.5.3) [gem]" level="application" />
|
|
32
|
+
<orderEntry type="library" scope="PROVIDED" name="diff-lcs (v1.3, RVM: ruby-2.5.3) [gem]" level="application" />
|
|
33
|
+
<orderEntry type="library" scope="PROVIDED" name="rspec (v3.9.0, RVM: ruby-2.5.3) [gem]" level="application" />
|
|
11
34
|
</component>
|
|
12
35
|
</module>
|
data/Gemfile.lock
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
PATH
|
|
2
2
|
remote: .
|
|
3
3
|
specs:
|
|
4
|
-
istox (0.1.
|
|
4
|
+
istox (0.1.145)
|
|
5
5
|
awesome_print
|
|
6
6
|
binding_of_caller
|
|
7
7
|
bunny (>= 2.12.0)
|
|
@@ -65,7 +65,7 @@ GEM
|
|
|
65
65
|
arel (9.0.0)
|
|
66
66
|
awesome_print (1.8.0)
|
|
67
67
|
aws-eventstream (1.1.0)
|
|
68
|
-
aws-sigv4 (1.1.
|
|
68
|
+
aws-sigv4 (1.1.2)
|
|
69
69
|
aws-eventstream (~> 1.0, >= 1.0.2)
|
|
70
70
|
binding_of_caller (0.8.0)
|
|
71
71
|
debug_inspector (>= 0.0.1)
|
|
@@ -98,18 +98,18 @@ GEM
|
|
|
98
98
|
ffi (1.12.2)
|
|
99
99
|
globalid (0.4.2)
|
|
100
100
|
activesupport (>= 4.2.0)
|
|
101
|
-
google-protobuf (3.11.4
|
|
101
|
+
google-protobuf (3.11.4)
|
|
102
102
|
googleapis-common-protos-types (1.0.5)
|
|
103
103
|
google-protobuf (~> 3.11)
|
|
104
104
|
graphlient (0.3.7)
|
|
105
105
|
faraday
|
|
106
106
|
faraday_middleware
|
|
107
107
|
graphql-client
|
|
108
|
-
graphql (1.10.
|
|
108
|
+
graphql (1.10.7)
|
|
109
109
|
graphql-client (0.16.0)
|
|
110
110
|
activesupport (>= 3.0)
|
|
111
111
|
graphql (~> 1.8)
|
|
112
|
-
grpc (1.28.0
|
|
112
|
+
grpc (1.28.0)
|
|
113
113
|
google-protobuf (~> 3.11)
|
|
114
114
|
googleapis-common-protos-types (~> 1.0)
|
|
115
115
|
grpc-tools (1.28.0)
|
|
@@ -148,7 +148,7 @@ GEM
|
|
|
148
148
|
nokogiri (1.10.9)
|
|
149
149
|
mini_portile2 (~> 2.4.0)
|
|
150
150
|
oj (3.10.6)
|
|
151
|
-
ougai (1.8.
|
|
151
|
+
ougai (1.8.4)
|
|
152
152
|
oj (~> 3.10)
|
|
153
153
|
paranoia (2.4.2)
|
|
154
154
|
activerecord (>= 4.0, < 6.1)
|
|
@@ -355,7 +355,14 @@ module Istox
|
|
|
355
355
|
end
|
|
356
356
|
|
|
357
357
|
def find_trackers(pattern)
|
|
358
|
-
|
|
358
|
+
cursor = 0
|
|
359
|
+
all_keys = []
|
|
360
|
+
loop {
|
|
361
|
+
cursor, keys = ::Istox::RedisBoot.scan(cursor, {:match => pattern, :count => 500}, 4)
|
|
362
|
+
all_keys += keys
|
|
363
|
+
break if cursor == "0"
|
|
364
|
+
}
|
|
365
|
+
all_keys.uniq
|
|
359
366
|
end
|
|
360
367
|
|
|
361
368
|
def get_tracker(key)
|
|
@@ -81,6 +81,8 @@ module Istox
|
|
|
81
81
|
# Start new thread on receiving ACK from 'confirm-1' channel on the specified thread
|
|
82
82
|
Thread.new do
|
|
83
83
|
loop do
|
|
84
|
+
sleep 5
|
|
85
|
+
|
|
84
86
|
begin
|
|
85
87
|
success = @channel[threadId]['confirm-1'].wait_for_confirms
|
|
86
88
|
if success
|
|
@@ -105,8 +107,6 @@ module Istox
|
|
|
105
107
|
rescue => e
|
|
106
108
|
# log.debug "wait_for_confirm error happening: #{e}"
|
|
107
109
|
end
|
|
108
|
-
|
|
109
|
-
sleep 2
|
|
110
110
|
end
|
|
111
111
|
end
|
|
112
112
|
|
data/lib/istox/helpers/redis.rb
CHANGED
|
@@ -8,8 +8,8 @@ module Istox
|
|
|
8
8
|
redis(db).set(k,v, options)
|
|
9
9
|
end
|
|
10
10
|
|
|
11
|
-
def
|
|
12
|
-
redis(db).
|
|
11
|
+
def scan(cursor, options = {}, db)
|
|
12
|
+
redis(db).scan cursor, options
|
|
13
13
|
end
|
|
14
14
|
|
|
15
15
|
def del(k, db)
|
|
@@ -43,10 +43,12 @@ module Istox
|
|
|
43
43
|
private
|
|
44
44
|
|
|
45
45
|
def redis(db)
|
|
46
|
-
@redis
|
|
46
|
+
@redis = {} if @redis.nil?
|
|
47
|
+
@redis[db] = Redis.new(
|
|
47
48
|
url: ENV["REDIS_URL"] || 'redis://127.0.0.1',
|
|
48
49
|
db: db
|
|
49
|
-
)
|
|
50
|
+
) if @redis[db].nil?
|
|
51
|
+
@redis[db]
|
|
50
52
|
end
|
|
51
53
|
end
|
|
52
54
|
end
|
|
@@ -5,8 +5,6 @@ module Istox
|
|
|
5
5
|
class << self
|
|
6
6
|
#### keys must be an array
|
|
7
7
|
def cache(data:, key:, fields: nil, field: nil)
|
|
8
|
-
return unless enable?
|
|
9
|
-
|
|
10
8
|
fields = [] if fields.blank?
|
|
11
9
|
fields.push(field) if field.present?
|
|
12
10
|
|
|
@@ -32,8 +30,6 @@ module Istox
|
|
|
32
30
|
end
|
|
33
31
|
|
|
34
32
|
def remove(key:, fields: nil, field: nil)
|
|
35
|
-
return unless enable?
|
|
36
|
-
|
|
37
33
|
fields = [] if fields.blank?
|
|
38
34
|
fields.push(field) if field.present?
|
|
39
35
|
|
|
@@ -55,26 +51,22 @@ module Istox
|
|
|
55
51
|
def get(key:, field:)
|
|
56
52
|
raise 'You must provide a callback block if cache doesnt exist' unless block_given?
|
|
57
53
|
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
key = key.to_s
|
|
62
|
-
field = field.to_s
|
|
54
|
+
key = key.to_s
|
|
55
|
+
field = field.to_s
|
|
63
56
|
|
|
64
|
-
|
|
57
|
+
result = redis.hget(key, field)
|
|
65
58
|
|
|
66
|
-
|
|
59
|
+
log.debug "Getting data from cache, key: #{key}, field: #{field}, result: #{result.inspect}"
|
|
67
60
|
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
end
|
|
75
|
-
else
|
|
76
|
-
log.debug 'Fallback to data retrieval block.'
|
|
61
|
+
if result.present?
|
|
62
|
+
begin
|
|
63
|
+
return ::Istox::CommonHelper.to_open_struct(JSON.parse(result))
|
|
64
|
+
rescue StandardError => e
|
|
65
|
+
log.warn('Unable to process result from cache store, is it not a json?')
|
|
66
|
+
log.warn(e)
|
|
77
67
|
end
|
|
68
|
+
else
|
|
69
|
+
log.debug 'Fallback to data retrieval block.'
|
|
78
70
|
end
|
|
79
71
|
|
|
80
72
|
yield if block_given?
|
|
@@ -90,10 +82,6 @@ module Istox
|
|
|
90
82
|
db: 5
|
|
91
83
|
))
|
|
92
84
|
end
|
|
93
|
-
|
|
94
|
-
def enable?
|
|
95
|
-
ENV.fetch('ENABLE_REMOTE_MODEL_CACHING', true).to_s.downcase == 'true'
|
|
96
|
-
end
|
|
97
85
|
end
|
|
98
86
|
end
|
|
99
87
|
end
|
|
@@ -158,7 +158,8 @@ module Istox
|
|
|
158
158
|
result = @workers[ruby_class].process(processing_payload, metadata, delivery_info)
|
|
159
159
|
end
|
|
160
160
|
else
|
|
161
|
-
|
|
161
|
+
# Instead of cache msg, print log
|
|
162
|
+
log.fatal "Drop msg at #{Time.now.to_s} for queue #{queue.name}, payload is #{JSON.dump(payload)}" if store
|
|
162
163
|
end
|
|
163
164
|
# active_channel.ack(delivery_info.delivery_tag) if manual_ack
|
|
164
165
|
rescue StandardError => e
|
data/lib/istox/version.rb
CHANGED
metadata
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: istox
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.1.
|
|
4
|
+
version: 0.1.147
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Siong Leng
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: exe
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date: 2020-04-
|
|
11
|
+
date: 2020-04-26 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: awesome_print
|
|
@@ -475,7 +475,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
|
475
475
|
- !ruby/object:Gem::Version
|
|
476
476
|
version: '0'
|
|
477
477
|
requirements: []
|
|
478
|
-
rubygems_version: 3.0.
|
|
478
|
+
rubygems_version: 3.0.8
|
|
479
479
|
signing_key:
|
|
480
480
|
specification_version: 4
|
|
481
481
|
summary: istox backend shared gem
|