istox 0.2.14.2 → 0.2.16
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/.gitignore +0 -0
- data/.rubocop.yml +0 -0
- data/.solargraph.yml +0 -0
- data/CODE_OF_CONDUCT.md +0 -0
- data/Gemfile +0 -0
- data/Gemfile.lock +1 -1
- data/README.md +0 -0
- data/Rakefile +0 -0
- data/lib/istox/constants/error.rb +0 -0
- data/lib/istox/helpers/f_math.rb +16 -2
- data/lib/istox/helpers/gruf_listener_hook.rb +0 -0
- data/lib/istox/helpers/my_open_struct.rb +0 -0
- data/lib/istox/helpers/race_condition_helper.rb +11 -1
- data/lib/istox/helpers/rate_limit.rb +0 -0
- data/lib/istox/helpers/regex_helper.rb +0 -0
- data/lib/istox/helpers/result_handler.rb +0 -0
- data/lib/istox/helpers/vault.rb +0 -0
- data/lib/istox/interfaces/chainhub/transaction.rb +0 -0
- data/lib/istox/models/concerns/blockchain_receipt_query.rb +0 -0
- 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: 427be1c188660fb5026b4939d6fe6aeceb05cee84fea5fc44f4e21563b4eb51b
|
4
|
+
data.tar.gz: '0068748b30c528b7590148db9aff3cd8b0cef427acf32e433b78d748ad5a11cb'
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: cc56633832f232ab416252243601af865d162024ffc3047da66e80c65cc3e05ac8c1e615c98a87ea34bee8547d01b1ea8e954f767f82b87d949f262ea14b4764
|
7
|
+
data.tar.gz: edceb0279ab02097e365420168f6fbb80a68e01afd266958f0acdaa14c4086a0f22e02138b52b04f42aa098dc9bb2b0afbfd3688c54952142eca1d8147561bae
|
data/.gitignore
CHANGED
File without changes
|
data/.rubocop.yml
CHANGED
File without changes
|
data/.solargraph.yml
CHANGED
File without changes
|
data/CODE_OF_CONDUCT.md
CHANGED
File without changes
|
data/Gemfile
CHANGED
File without changes
|
data/Gemfile.lock
CHANGED
data/README.md
CHANGED
File without changes
|
data/Rakefile
CHANGED
File without changes
|
File without changes
|
data/lib/istox/helpers/f_math.rb
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
# rubocop:disable Naming/
|
1
|
+
# rubocop:disable Naming/MethodParameterName
|
2
2
|
module Istox
|
3
3
|
class FMath
|
4
4
|
class << self
|
@@ -74,6 +74,20 @@ module Istox
|
|
74
74
|
::BigDecimal.new(x.to_s).round(digits).to_s
|
75
75
|
end
|
76
76
|
|
77
|
+
def round_half_up(x, digits)
|
78
|
+
BigDecimal.mode(BigDecimal::ROUND_MODE, :half_up)
|
79
|
+
x = 0 if x.blank?
|
80
|
+
::BigDecimal.new(x.to_s).round(digits).to_s
|
81
|
+
end
|
82
|
+
|
83
|
+
def round(x, digits, rounding_mechanism: :natural)
|
84
|
+
return round_up(x, digits) if rounding_mechanism == 'up'
|
85
|
+
|
86
|
+
return round_down(x, digits) if rounding_mechanism == 'down'
|
87
|
+
|
88
|
+
round_half_up(x, digits)
|
89
|
+
end
|
90
|
+
|
77
91
|
private
|
78
92
|
|
79
93
|
def to_fixed(x)
|
@@ -86,4 +100,4 @@ module Istox
|
|
86
100
|
end
|
87
101
|
end
|
88
102
|
end
|
89
|
-
# rubocop:enable Naming/
|
103
|
+
# rubocop:enable Naming/MethodParameterName
|
File without changes
|
File without changes
|
@@ -13,7 +13,7 @@ module Istox
|
|
13
13
|
log.info("Acquiring lock for key: #{key}, expired in #{expired_seconds} seconds, result: #{result}")
|
14
14
|
|
15
15
|
# if result false means the key already exist
|
16
|
-
result
|
16
|
+
[true, 1].include?(result)
|
17
17
|
end
|
18
18
|
|
19
19
|
def release(key)
|
@@ -22,6 +22,16 @@ module Istox
|
|
22
22
|
log.info("Releasing lock for key: #{key}")
|
23
23
|
end
|
24
24
|
|
25
|
+
### lock with block
|
26
|
+
def lock!(key, expired_seconds: 20)
|
27
|
+
acquire!(key, expired_seconds: expired_seconds)
|
28
|
+
yield
|
29
|
+
release(key)
|
30
|
+
rescue StandardError => e
|
31
|
+
release(key)
|
32
|
+
raise e
|
33
|
+
end
|
34
|
+
|
25
35
|
def request_redis
|
26
36
|
@request_redis ||= ::Istox::RedisManager.request_redis
|
27
37
|
end
|
File without changes
|
File without changes
|
File without changes
|
data/lib/istox/helpers/vault.rb
CHANGED
File without changes
|
File without changes
|
File without changes
|
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.2.
|
4
|
+
version: 0.2.16
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Siong Leng
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2021-
|
11
|
+
date: 2021-08-24 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: amazing_print
|
@@ -534,7 +534,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
534
534
|
- !ruby/object:Gem::Version
|
535
535
|
version: '0'
|
536
536
|
requirements: []
|
537
|
-
rubygems_version: 3.
|
537
|
+
rubygems_version: 3.2.11
|
538
538
|
signing_key:
|
539
539
|
specification_version: 4
|
540
540
|
summary: istox backend shared gem
|