Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
hive-ruby
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container Registry
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
hive
hive-ruby
Commits
421e4cb3
Commit
421e4cb3
authored
6 years ago
by
Anthony Martin
Browse files
Options
Downloads
Patches
Plain Diff
add retry elements for dealing with errors in batch responses #6
parent
fc8f7cc2
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
lib/steem/stream.rb
+12
-4
12 additions, 4 deletions
lib/steem/stream.rb
with
12 additions
and
4 deletions
lib/steem/stream.rb
+
12
−
4
View file @
421e4cb3
...
...
@@ -91,6 +91,14 @@ module Steem
# @option options [Integer] :until_block_num Ends the stream at the given block number. Default: nil.
def
transactions
(
options
=
{},
&
block
)
blocks
(
options
)
do
|
block
,
block_num
|
if
block
.
nil?
warn
"Batch missing block_num:
#{
block_num
}
, retrying ..."
block
=
block_api
.
get_block
(
block_num:
block_num
)
do
|
result
|
result
.
block
end
end
block
.
transactions
.
each_with_index
do
|
transaction
,
index
|
trx_id
=
block
.
transaction_ids
[
index
]
...
...
@@ -332,9 +340,8 @@ module Steem
end
response
=
account_history_api
.
get_ops_in_block
(
*
get_ops_in_block_options
)
result
=
response
.
result
if
res
ult
.
nil?
if
res
ponse
.
nil?
||
(
result
=
response
.
result
)
.
nil?
if
retries
<
MAX_RETRY_COUNT
warn
"Retrying get_ops_in_block on block
#{
block_num
}
"
unless
@no_warn
retries
=
retries
+
1
...
...
@@ -360,7 +367,8 @@ module Steem
retries
=
retries
+
1
redo
else
raise
TooManyRetriesError
,
"unable to find virtual operations for block:
#{
block_num
}
"
warn
"unable to find virtual operations for block:
#{
block_num
}
"
# raise TooManyRetriesError, "unable to find virtual operations for block: #{block_num}"
end
end
...
...
@@ -374,4 +382,4 @@ module Steem
end
end
end
end
\ No newline at end of file
end
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment