stellar_spectrum 1.3.0 → 1.3.1
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/CHANGELOG.md +4 -0
- data/Gemfile.lock +2 -2
- data/lib/stellar_spectrum.rb +1 -0
- data/lib/stellar_spectrum/services/sending_payment/get_sleep_for_retry.rb +16 -0
- data/lib/stellar_spectrum/services/sending_payment/retry.rb +2 -2
- data/lib/stellar_spectrum/services/sending_payment/send_asset.rb +12 -2
- data/lib/stellar_spectrum/version.rb +1 -1
- metadata +4 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: e42c3edaf38084503ffb4be0c4c8444b8c1ccbe26ecd5ac15736d7dad7f07cf2
|
4
|
+
data.tar.gz: 6c5fadae0a06979888c64b06147299fcf563a01d58a317b3a2df968e0d8c79df
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 13e82996a13fc2a5a47fdc8a7be91fc7c0f87280ab081339e044ea8c214cd38c6a2182af95b0ed4f780e0285860cf8055454903c48abc49971f948d46bef3f8f
|
7
|
+
data.tar.gz: 012a52068e0d1883749dcfc333770713472e21fbfd2ad32a34d4d83d5fd65777bfbaf6b91bf27a3ec8771ae1dea8e53332bea7e148111da3e293e666d670b8fe
|
data/CHANGELOG.md
CHANGED
@@ -4,6 +4,10 @@ All notable changes to this project will be documented in this file.
|
|
4
4
|
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
|
5
5
|
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
6
6
|
|
7
|
+
## [1.3.1] - 2019-02-16
|
8
|
+
### Fixed
|
9
|
+
- During retry, do not sleep more than the max lock time
|
10
|
+
|
7
11
|
## [1.3.0] - 2019-01-29
|
8
12
|
### Fixed
|
9
13
|
- Do not retry forever (and hitting the stack limit)
|
data/Gemfile.lock
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
stellar_spectrum (1.3.
|
4
|
+
stellar_spectrum (1.3.1)
|
5
5
|
activesupport
|
6
6
|
gem_config
|
7
7
|
light-service
|
@@ -38,7 +38,7 @@ GEM
|
|
38
38
|
net-http-digest_auth (~> 1.4)
|
39
39
|
faraday_hal_middleware (0.1.0)
|
40
40
|
faraday_middleware (~> 0.9)
|
41
|
-
faraday_middleware (0.13.
|
41
|
+
faraday_middleware (0.13.1)
|
42
42
|
faraday (>= 0.7.4, < 1.0)
|
43
43
|
ffi (1.10.0)
|
44
44
|
gem_config (0.3.1)
|
data/lib/stellar_spectrum.rb
CHANGED
@@ -25,6 +25,7 @@ require "stellar_spectrum/services/send_payment"
|
|
25
25
|
require "stellar_spectrum/services/sending_payment/attempt_release_lock"
|
26
26
|
require "stellar_spectrum/services/sending_payment/retry"
|
27
27
|
require "stellar_spectrum/services/sending_payment/send_asset"
|
28
|
+
require "stellar_spectrum/services/sending_payment/get_sleep_for_retry"
|
28
29
|
require "stellar_spectrum/services/unlocking/attempt_release"
|
29
30
|
require "stellar_spectrum/services/unlocking/check_sequence_number"
|
30
31
|
require "stellar_spectrum/services/unlocking/unlock"
|
@@ -0,0 +1,16 @@
|
|
1
|
+
module StellarSpectrum
|
2
|
+
module SendingPayment
|
3
|
+
class GetSleepForRetry
|
4
|
+
|
5
|
+
MAX = Client::MAX_LOCK_TIME_IN_SECONDS
|
6
|
+
LEEWAY = 5.freeze
|
7
|
+
|
8
|
+
def self.call(n)
|
9
|
+
fibo = Fibo.(n)
|
10
|
+
return fibo if fibo < MAX
|
11
|
+
MAX - LEEWAY
|
12
|
+
end
|
13
|
+
|
14
|
+
end
|
15
|
+
end
|
16
|
+
end
|
@@ -20,7 +20,7 @@ module StellarSpectrum
|
|
20
20
|
promises :send_asset_response
|
21
21
|
|
22
22
|
executed do |c|
|
23
|
-
sleep
|
23
|
+
sleep GetSleepForRetry.(c.tries)
|
24
24
|
|
25
25
|
args = EXPECTS.each_with_object({}) do |attr, hash|
|
26
26
|
hash[attr] = c.send(attr)
|
@@ -34,7 +34,7 @@ module StellarSpectrum
|
|
34
34
|
# fail_and_return for now until we figure out a way to stop all actions
|
35
35
|
# from reduce_if
|
36
36
|
# See https://github.com/adomokos/light-service/pull/164
|
37
|
-
message = "Closing
|
37
|
+
message = "Closing #{c.tries.ordinalize} try"
|
38
38
|
c.fail_and_return! message
|
39
39
|
end
|
40
40
|
|
@@ -30,9 +30,19 @@ module StellarSpectrum
|
|
30
30
|
sequence: c.next_sequence_number,
|
31
31
|
)
|
32
32
|
rescue Faraday::ClientError => e
|
33
|
-
|
33
|
+
max_tries = StellarSpectrum.configuration.max_tries
|
34
|
+
if c.tries >= max_tries
|
35
|
+
Log.warn(
|
36
|
+
"Surpassed maximum number of tries of #{max_tries}, " \
|
37
|
+
"stop retrying"
|
38
|
+
)
|
39
|
+
fail
|
40
|
+
end
|
34
41
|
|
35
|
-
Log.warn(
|
42
|
+
Log.warn(
|
43
|
+
"Retrying (#{c.tries.ordinalize} time) " \
|
44
|
+
"SendingPayment::SendAsset - #{e.inspect}"
|
45
|
+
)
|
36
46
|
retry_result = Retry.execute(
|
37
47
|
stellar_client: c.stellar_client,
|
38
48
|
from: c.from,
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: stellar_spectrum
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.3.
|
4
|
+
version: 1.3.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Ramon Tayag
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: exe
|
11
11
|
cert_chain: []
|
12
|
-
date: 2019-
|
12
|
+
date: 2019-02-16 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: activesupport
|
@@ -191,6 +191,7 @@ files:
|
|
191
191
|
- lib/stellar_spectrum/services/pick_channel.rb
|
192
192
|
- lib/stellar_spectrum/services/send_payment.rb
|
193
193
|
- lib/stellar_spectrum/services/sending_payment/attempt_release_lock.rb
|
194
|
+
- lib/stellar_spectrum/services/sending_payment/get_sleep_for_retry.rb
|
194
195
|
- lib/stellar_spectrum/services/sending_payment/retry.rb
|
195
196
|
- lib/stellar_spectrum/services/sending_payment/send_asset.rb
|
196
197
|
- lib/stellar_spectrum/services/unlocking/attempt_release.rb
|
@@ -222,7 +223,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
222
223
|
version: '0'
|
223
224
|
requirements: []
|
224
225
|
rubyforge_project:
|
225
|
-
rubygems_version: 2.7.
|
226
|
+
rubygems_version: 2.7.8
|
226
227
|
signing_key:
|
227
228
|
specification_version: 4
|
228
229
|
summary: Use Stellar payment channels in Ruby with ease
|