Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
B
beem
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
beem
Commits
b5a7da90
Commit
b5a7da90
authored
7 years ago
by
Holger Nahrstaedt
Browse files
Options
Downloads
Patches
Plain Diff
fix steemnoderpc for threading
parent
3ff0b890
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
beemapi/steemnoderpc.py
+12
-5
12 additions, 5 deletions
beemapi/steemnoderpc.py
beemgrapheneapi/graphenerpc.py
+1
-1
1 addition, 1 deletion
beemgrapheneapi/graphenerpc.py
with
13 additions
and
6 deletions
beemapi/steemnoderpc.py
+
12
−
5
View file @
b5a7da90
...
@@ -39,10 +39,12 @@ class SteemNodeRPC(GrapheneRPC):
...
@@ -39,10 +39,12 @@ class SteemNodeRPC(GrapheneRPC):
:raises RPCError: if the server returns an error
:raises RPCError: if the server returns an error
"""
"""
doRetry
=
True
doRetry
=
True
while
doRetry
and
self
.
error_cnt_call
<
self
.
num_retries_call
:
cnt
=
0
while
doRetry
and
cnt
<
self
.
num_retries_call
:
doRetry
=
False
doRetry
=
False
try
:
try
:
# Forward call to GrapheneWebsocketRPC and catch+evaluate errors
# Forward call to GrapheneWebsocketRPC and catch+evaluate errors
self
.
error_cnt_call
=
cnt
return
super
(
SteemNodeRPC
,
self
).
rpcexec
(
payload
)
return
super
(
SteemNodeRPC
,
self
).
rpcexec
(
payload
)
except
exceptions
.
RPCError
as
e
:
except
exceptions
.
RPCError
as
e
:
msg
=
exceptions
.
decodeRPCErrorMsg
(
e
).
strip
()
msg
=
exceptions
.
decodeRPCErrorMsg
(
e
).
strip
()
...
@@ -57,21 +59,26 @@ class SteemNodeRPC(GrapheneRPC):
...
@@ -57,21 +59,26 @@ class SteemNodeRPC(GrapheneRPC):
elif
re
.
search
(
"
Could not find API
"
,
msg
):
elif
re
.
search
(
"
Could not find API
"
,
msg
):
raise
exceptions
.
NoApiWithName
(
msg
)
raise
exceptions
.
NoApiWithName
(
msg
)
elif
re
.
search
(
"
Unable to acquire database lock
"
,
msg
):
elif
re
.
search
(
"
Unable to acquire database lock
"
,
msg
):
sleep_and_check_retries
(
self
.
num_retries_call
,
self
.
error_cnt_call
,
self
.
url
,
str
(
msg
))
sleep_and_check_retries
(
self
.
num_retries_call
,
cnt
,
self
.
url
,
str
(
msg
))
doRetry
=
True
doRetry
=
True
elif
re
.
search
(
"
Internal Error
"
,
msg
):
elif
re
.
search
(
"
Internal Error
"
,
msg
):
sleep_and_check_retries
(
self
.
num_retries_call
,
self
.
error_cnt_call
,
self
.
url
,
str
(
msg
))
sleep_and_check_retries
(
self
.
num_retries_call
,
cnt
,
self
.
url
,
str
(
msg
))
doRetry
=
True
doRetry
=
True
elif
re
.
search
(
"
Service Temporarily Unavailable
"
,
msg
):
elif
re
.
search
(
"
Service Temporarily Unavailable
"
,
msg
):
sleep_and_check_retries
(
self
.
num_retries_call
,
self
.
error_cnt_call
,
self
.
url
,
str
(
msg
))
sleep_and_check_retries
(
self
.
num_retries_call
,
cnt
,
self
.
url
,
str
(
msg
))
doRetry
=
True
doRetry
=
True
elif
re
.
search
(
"
Bad Gateway
"
,
msg
):
elif
re
.
search
(
"
Bad Gateway
"
,
msg
):
sleep_and_check_retries
(
self
.
num_retries_call
,
self
.
error_cnt_call
,
self
.
url
,
str
(
msg
))
sleep_and_check_retries
(
self
.
num_retries_call
,
cnt
,
self
.
url
,
str
(
msg
))
doRetry
=
True
doRetry
=
True
elif
msg
:
elif
msg
:
raise
exceptions
.
UnhandledRPCError
(
msg
)
raise
exceptions
.
UnhandledRPCError
(
msg
)
else
:
else
:
raise
e
raise
e
if
doRetry
:
if
self
.
error_cnt_call
==
0
:
cnt
+=
1
else
:
cnt
=
self
.
error_cnt_call
+
1
except
Exception
as
e
:
except
Exception
as
e
:
raise
e
raise
e
...
...
This diff is collapsed.
Click to expand it.
beemgrapheneapi/graphenerpc.py
+
1
−
1
View file @
b5a7da90
...
@@ -53,7 +53,7 @@ class GrapheneRPC(object):
...
@@ -53,7 +53,7 @@ class GrapheneRPC(object):
:param str user: Username for Authentication
:param str user: Username for Authentication
:param str password: Password for Authentication
:param str password: Password for Authentication
:param int num_retries: Try x times to num_retries to a node on disconnect, -1 for indefinitely
:param int num_retries: Try x times to num_retries to a node on disconnect, -1 for indefinitely
:param int num_retries_call: Repeat num_retries_call times a rpccall on node error (default is 5)
:param int num_retries_call: Repeat num_retries_call times a rpc
call on node error (default is 5)
Available APIs
Available APIs
* database
* database
...
...
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