istox 0.1.157.8.1 → 0.1.157.11.t2

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: 2e787b820875724210c795bc5680cf04aa5a97a1dd970b340401ae31b3f1e633
4
- data.tar.gz: 9cbb1ce9c31dda340d667c6b11c11f370a4a93399c55f9223889576f56d74daf
3
+ metadata.gz: 0b060ee3ff5a5d08de37ec1bfc82c3323e0043e057cb85538dd0da9825620ebd
4
+ data.tar.gz: ccd3ae5ac920b3852b4346547d3e7163c363ff9cfcb9c883a7b65091e0c5747e
5
5
  SHA512:
6
- metadata.gz: 6d3fb11ec569218347a09adfd9cbe5776f2b6d96ea1cb2d395e199a285e5d8d6911f44e85d2620772f369d16f2f3899ab718139cc9715a7a255fd33b51291e3b
7
- data.tar.gz: 135d14048048cedb8dcbc1bf10fa58a42f0a79d3db433376574e594a1497875a2708f52f349165dc2e5954115a3691d96ef53b456040be6c9348cf49c2b03339
6
+ metadata.gz: 86238a996b1b09379df6c5e3d0301397daa4add5e75690c888d631358c824cab0c939812377d6777e92b526d7f88ad65108dbd286a7918bdd559fc087624a98e
7
+ data.tar.gz: 10132f756ee02e38e7b2a08950b4b8f23bc1c7f713d34e11cfebd5d154f8b3aa3374e578df07b2f57edaf28aafbb18d49ffb6334e4c800e7caf9da271fd17380
@@ -26,7 +26,12 @@ module Istox
26
26
  txhash: transaction.txn_hashes.present? ? transaction.txn_hashes.join(',') : nil)
27
27
 
28
28
  resource = begin
29
- class_eval("::#{receipt.resource_name}", __FILE__, __LINE__).find(receipt.resource_id)
29
+ cls = class_eval("::#{receipt.resource_name}", __FILE__, __LINE__)
30
+ if cls.respond_to?('with_deleted')
31
+ cls.with_deleted.find(receipt.resource_id)
32
+ else
33
+ cls.find(receipt.resource_id)
34
+ end
30
35
  rescue NameError
31
36
  log.warn "Transaction bind to #{receipt.resource_name} with id #{receipt.resource_id} class not found, skipping..."
32
37
  return
@@ -8,8 +8,8 @@ module Istox
8
8
  @@blockchain_receipt_klass
9
9
  end
10
10
 
11
- def self.request(sid:, action:, before:, execute:)
12
- start(sid: sid, action: action, before: before, execute: execute, is_request: true)
11
+ def self.request(sid:, action:, before:, execute:, request_reason: nil)
12
+ start(sid: sid, action: action, before: before, execute: execute, is_request: true, request_reason: request_reason)
13
13
  end
14
14
 
15
15
  def self.run(sid:, action:, before:, execute:)
@@ -19,7 +19,7 @@ module Istox
19
19
  private
20
20
 
21
21
  # before is the proc that will be executed before, must return the main model blockchain receipt will bind to
22
- def start(sid:, action:, before:, execute:, is_request: false)
22
+ def start(sid:, action:, before:, execute:, is_request: false, request_reason: nil)
23
23
  # create blockchain receipt first
24
24
  klass = blockchain_receipt_class
25
25
  uuid = ::SecureRandom.uuid
@@ -27,6 +27,7 @@ module Istox
27
27
  txid: uuid,
28
28
  sid: sid,
29
29
  is_request: is_request,
30
+ request_reason: request_reason,
30
31
  resource_action: action
31
32
  )
32
33
 
@@ -82,7 +82,12 @@ module Istox
82
82
 
83
83
  log.info 'Reinitiating to grpc host at ' + host_url
84
84
  t1 = Time.now
85
- @@services[get_key(host_type, service)] = ::Gruf::Client.new(service: service, options: { hostname: host_url }, client_options: client_options)
85
+ grpc_options = { hostname: host_url }
86
+ if ENV.fetch('USE_SSL_CHANNEL', false)
87
+ log.info 'Use SSL connection...'
88
+ grpc_options[:channel_credentials] = GRPC::Core::ChannelCredentials.new()
89
+ end
90
+ @@services[get_key(host_type, service)] = ::Gruf::Client.new(service: service, options: grpc_options, client_options: client_options)
86
91
  log.info "Time taken for reinitiating grpc host: #{Time.now - t1} seconds"
87
92
  end
88
93
 
@@ -14,7 +14,7 @@ module Istox
14
14
 
15
15
  message = JSON.generate(message) unless message.is_a? String
16
16
 
17
- sns_client.publish({ topic_arn: topic_arn || ENV.fetch('PUSHER_TOPIC_ARN', ''), message: message })
17
+ sns_client.publish(topic_arn: topic_arn || ENV.fetch('SNS_CLIENT_TOPIC', ''), message: message)
18
18
 
19
19
  log.info('Publish to SNS successfully.')
20
20
  rescue StandardError => e
@@ -28,8 +28,8 @@ module Istox
28
28
  def sns_client
29
29
  return @sns_client if @sns_client.present?
30
30
 
31
- Aws.config.update({ region: ENV.fetch('AWS_REGION', 'ap-southeast-1'),
32
- credentials: Aws::Credentials.new(ENV.fetch('AWS_STS_ACCESS_KEY_ID'), ENV.fetch('AWS_STS_SECRET_ACCESS_KEY')) })
31
+ Aws.config.update(region: ENV.fetch('AWS_REGION', 'ap-southeast-1'),
32
+ credentials: Aws::Credentials.new(ENV.fetch('AWS_STS_ACCESS_KEY_ID'), ENV.fetch('AWS_STS_SECRET_ACCESS_KEY')))
33
33
 
34
34
  @sns_client = Aws::SNS::Client.new(region: ENV.fetch('AWS_REGION', 'ap-southeast-1'))
35
35
  end
@@ -22,6 +22,7 @@ module Istox
22
22
 
23
23
  request_context.metadata[:xray_trace_id] = XRay.recorder.current_segment.trace_id
24
24
  request_context.metadata[:xray_parent_id] = XRay.recorder.current_segment.id
25
+ Thread.current[:tracer_id] = XRay.recorder.current_segment.trace_id
25
26
 
26
27
  result = yield
27
28
 
@@ -7,6 +7,7 @@ module Istox
7
7
  meta = request.active_call.metadata
8
8
  trace_id = (meta['xray_trace_id'] if meta.present? && meta.key?('xray_trace_id'))
9
9
  parent_id = (meta['xray_parent_id'] if meta.present? && meta.key?('xray_parent_id'))
10
+ Thread.current[:tracer_id] = trace_id
10
11
 
11
12
  XRay.recorder.begin_segment("#{::Istox::Xray::XrayInitializer.service_name}.grpc.#{request.method_key}",
12
13
  trace_id: trace_id, parent_id: parent_id)
@@ -8,6 +8,7 @@ module Istox
8
8
 
9
9
  trace_id = (payload_hash[:xray_trace_id] if payload_hash.key?(:xray_trace_id))
10
10
  parent_id = (payload_hash[:xray_parent_id] if payload_hash.key?(:xray_parent_id))
11
+ Thread.current[:tracer_id] = trace_id
11
12
 
12
13
  arr = [delivery_info[:exchange]&.downcase, delivery_info[:routing_key]&.downcase, payload_hash[:type]&.downcase].compact
13
14
 
@@ -22,6 +22,7 @@ module Istox
22
22
 
23
23
  message[:xray_trace_id] = XRay.recorder.current_segment.trace_id
24
24
  message[:xray_parent_id] = XRay.recorder.current_segment.id
25
+ Thread.current[:tracer_id] = XRay.recorder.current_segment.trace_id
25
26
 
26
27
  XRay.recorder.end_subsegment
27
28
 
@@ -1,3 +1,3 @@
1
1
  module Istox
2
- VERSION = '0.1.157.8.1'.freeze
2
+ VERSION = '0.1.157.11.t2'.freeze
3
3
  end
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.157.8.1
4
+ version: 0.1.157.11.t2
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-09-30 00:00:00.000000000 Z
11
+ date: 2021-01-26 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: amazing_print
@@ -480,14 +480,6 @@ extensions: []
480
480
  extra_rdoc_files: []
481
481
  files:
482
482
  - ".gitignore"
483
- - ".idea/.rakeTasks"
484
- - ".idea/encodings.xml"
485
- - ".idea/inspectionProfiles/Project_Default.xml"
486
- - ".idea/istox-gem.iml"
487
- - ".idea/misc.xml"
488
- - ".idea/modules.xml"
489
- - ".idea/vcs.xml"
490
- - ".idea/workspace.xml"
491
483
  - ".rubocop.yml"
492
484
  - ".solargraph.yml"
493
485
  - CODE_OF_CONDUCT.md
@@ -550,9 +542,9 @@ required_ruby_version: !ruby/object:Gem::Requirement
550
542
  version: '0'
551
543
  required_rubygems_version: !ruby/object:Gem::Requirement
552
544
  requirements:
553
- - - ">="
545
+ - - ">"
554
546
  - !ruby/object:Gem::Version
555
- version: '0'
547
+ version: 1.3.1
556
548
  requirements: []
557
549
  rubygems_version: 3.0.6
558
550
  signing_key:
@@ -1,7 +0,0 @@
1
- <?xml version="1.0" encoding="UTF-8"?>
2
- <Settings><!--This file was automatically generated by Ruby plugin.
3
- You are allowed to:
4
- 1. Remove rake task
5
- 2. Add existing rake tasks
6
- To add existing rake tasks automatically delete this file and reload the project.
7
- --><RakeGroup description="" fullCmd="" taksId="rake" /></Settings>
@@ -1,4 +0,0 @@
1
- <?xml version="1.0" encoding="UTF-8"?>
2
- <project version="4">
3
- <component name="Encoding" addBOMForNewFiles="with NO BOM" />
4
- </project>
@@ -1,6 +0,0 @@
1
- <component name="InspectionProjectProfileManager">
2
- <profile version="1.0">
3
- <option name="myName" value="Project Default" />
4
- <inspection_tool class="Rubocop" enabled="false" level="WARNING" enabled_by_default="false" />
5
- </profile>
6
- </component>
@@ -1,12 +0,0 @@
1
- <?xml version="1.0" encoding="UTF-8"?>
2
- <module type="RUBY_MODULE" version="4">
3
- <component name="ModuleRunConfigurationManager">
4
- <shared />
5
- </component>
6
- <component name="NewModuleRootManager">
7
- <content url="file://$MODULE_DIR$" />
8
- <orderEntry type="inheritedJdk" />
9
- <orderEntry type="sourceFolder" forTests="false" />
10
- <orderEntry type="library" scope="PROVIDED" name="bundler (v1.16.6, RVM: ruby-2.5.3 [global]) [gem]" level="application" />
11
- </component>
12
- </module>
@@ -1,7 +0,0 @@
1
- <?xml version="1.0" encoding="UTF-8"?>
2
- <project version="4">
3
- <component name="JavaScriptSettings">
4
- <option name="languageLevel" value="ES6" />
5
- </component>
6
- <component name="ProjectRootManager" version="2" project-jdk-name="RVM: ruby-2.5.3 [global]" project-jdk-type="RUBY_SDK" />
7
- </project>
@@ -1,8 +0,0 @@
1
- <?xml version="1.0" encoding="UTF-8"?>
2
- <project version="4">
3
- <component name="ProjectModuleManager">
4
- <modules>
5
- <module fileurl="file://$PROJECT_DIR$/.idea/istox-gem.iml" filepath="$PROJECT_DIR$/.idea/istox-gem.iml" />
6
- </modules>
7
- </component>
8
- </project>
@@ -1,6 +0,0 @@
1
- <?xml version="1.0" encoding="UTF-8"?>
2
- <project version="4">
3
- <component name="VcsDirectoryMappings">
4
- <mapping directory="$PROJECT_DIR$" vcs="Git" />
5
- </component>
6
- </project>