radiator 0.3.12 → 0.3.13

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
  SHA1:
3
- metadata.gz: 5c1c1462b5782d4dbdc1611cb6e3fa2977041aa2
4
- data.tar.gz: '068894ae4633baddca507d426a8c9d0069569219'
3
+ metadata.gz: 8b2942acc286e86b0495674fdf08ef83cb8b9ba1
4
+ data.tar.gz: 9b4f8c9eee079e0c1d7b31aa977a7a322c908c15
5
5
  SHA512:
6
- metadata.gz: a88b0789b7181d0ea3190bb31f317a23d11c0b914005b163a456675fad137a533084fafacfdd24fb17f107a203e5ea68486af56d7301fbcd51be4ca1d5f8ab33
7
- data.tar.gz: f294d130a832f32d5423ccd4d2dff2aee2f71e7e8b44e38c774461d633d5e184fac71351d031496ba653d9cba621d54677741469ecbc26bf565828d7ab2ae903
6
+ metadata.gz: 35d4b8aed21429194c6f1df3c4985daeef0163236011636b35cd17ffce48b4bc1cfec0c625bb62990bcb9a3b33c3ef7dfc4831de6921b6d17855c10f378e7b52
7
+ data.tar.gz: 1b2fed7d16822b22ac943c5f21454b9c6e843dc1519688bcc90b964b658824e27bab790e865d19775467fb39d6a9e6429dc5a03194cf7643c7f9ed452e73e3a1
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- radiator (0.3.12)
4
+ radiator (0.3.13)
5
5
  awesome_print (~> 1.7, >= 1.7.0)
6
6
  bitcoin-ruby (~> 0.0, >= 0.0.11)
7
7
  ffi (~> 1.9, >= 1.9.18)
@@ -16,7 +16,7 @@ GEM
16
16
  addressable (2.5.2)
17
17
  public_suffix (>= 2.0.2, < 4.0)
18
18
  awesome_print (1.8.0)
19
- bitcoin-ruby (0.0.12)
19
+ bitcoin-ruby (0.0.13)
20
20
  connection_pool (2.2.1)
21
21
  crack (0.4.3)
22
22
  safe_yaml (~> 1.0.0)
@@ -37,8 +37,8 @@ GEM
37
37
  multi_json (1.12.2)
38
38
  net-http-persistent (3.0.0)
39
39
  connection_pool (~> 2.2)
40
- public_suffix (3.0.0)
41
- rake (12.2.1)
40
+ public_suffix (3.0.1)
41
+ rake (12.3.0)
42
42
  safe_yaml (1.0.4)
43
43
  simplecov (0.15.1)
44
44
  docile (~> 1.1.0)
@@ -46,11 +46,11 @@ GEM
46
46
  simplecov-html (~> 0.10.0)
47
47
  simplecov-html (0.10.2)
48
48
  vcr (3.0.3)
49
- webmock (3.1.0)
49
+ webmock (3.1.1)
50
50
  addressable (>= 2.3.6)
51
51
  crack (>= 0.3.2)
52
52
  hashdiff
53
- yard (0.9.9)
53
+ yard (0.9.12)
54
54
 
55
55
  PLATFORMS
56
56
  ruby
data/README.md CHANGED
@@ -397,7 +397,7 @@ Radiator supports failover for situations where a node has, for example, become
397
397
 
398
398
  ```ruby
399
399
  options = {
400
- ur: 'https://api.steemit.com',
400
+ url: 'https://api.steemit.com',
401
401
  failover_urls: [
402
402
  'https://api.steemitstage.com',
403
403
  'https://gtg.steem.house:8090'
@@ -421,6 +421,22 @@ There is another rare scenario involving `::Transaction` broadcasts that's handl
421
421
  tx = Radiator::Transaction.new(wif: wif, recover_transactions_on_error: false)
422
422
  ```
423
423
 
424
+ ### Golos Failover Examples
425
+
426
+ Typically, you only need to pass `chain: :golos` to enable Golos. Failover is enabled by default. If you want to provide your own full nodes, use this format:
427
+
428
+ ```ruby
429
+ options = {
430
+ chain: :golos,
431
+ url: 'https://ws.golos.io',
432
+ failover_urls: [
433
+ 'https://api.golos.cf'
434
+ ]
435
+ }
436
+
437
+ api = Radiator::Api.new(options)
438
+ ```
439
+
424
440
  ## Debugging
425
441
 
426
442
  To enable debugging, set environment `LOG=DEBUG` before launching your app. E.g.:
@@ -485,7 +501,7 @@ Verify your code is not doing too much between blocks.
485
501
  <img src="http://www.steemimg.com/images/2016/08/19/RadiatorCoolingFan-54in-Webfdcb1.png" />
486
502
  </center>
487
503
 
488
- See my previous Ruby How To posts in: [#radiator](https://steemit.com/created/radiator) [#ruby](https://steemit.com/created/ruby)
504
+ See my previous Ruby How To posts in: [/f/ruby](https://chainbb.com/f/ruby)
489
505
 
490
506
  ## Get in touch!
491
507
 
data/lib/radiator/api.rb CHANGED
@@ -423,6 +423,10 @@ module Radiator
423
423
  loop do
424
424
  tries += 1
425
425
 
426
+ if tries > 5 && flappy? && !check_file_open?
427
+ raise ApiError, 'PANIC: Out of file resources'
428
+ end
429
+
426
430
  begin
427
431
  if tries > 1 && @recover_transactions_on_error && api_name == :network_broadcast_api
428
432
  signatures, exp = extract_signatures(options)
@@ -640,6 +644,16 @@ module Radiator
640
644
  count += 1
641
645
  raise ApiError, "Race condition detected on remote node at: #{block_num}" if block.nil?
642
646
 
647
+ # TODO Some blockchains (like Golos) do not have transaction_ids. In
648
+ # the future, it would be better to decode the operation and signature
649
+ # into the transaction id.
650
+ # See: https://github.com/steemit/steem/issues/187
651
+ # See: https://github.com/GolosChain/golos/issues/281
652
+ unless defined? block.transaction_ids
653
+ @recover_transactions_on_error = false
654
+ return
655
+ end
656
+
643
657
  timestamp = Time.parse(block.timestamp + 'Z')
644
658
  break if timestamp < after
645
659
 
@@ -767,6 +781,12 @@ module Radiator
767
781
  end
768
782
  end
769
783
 
784
+ def check_file_open?
785
+ File.exists?('.')
786
+ rescue
787
+ false
788
+ end
789
+
770
790
  def backoff
771
791
  shutdown
772
792
  bump_failover if flappy? || !healthy?(uri)
@@ -1,4 +1,4 @@
1
1
  module Radiator
2
- VERSION = '0.3.12'
2
+ VERSION = '0.3.13'
3
3
  AGENT_ID = "radiator/#{VERSION}"
4
4
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: radiator
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.12
4
+ version: 0.3.13
5
5
  platform: ruby
6
6
  authors:
7
7
  - Anthony Martin
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2017-11-06 00:00:00.000000000 Z
11
+ date: 2017-11-27 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler