Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
H
hivemind
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Deploy
Releases
Package registry
Container Registry
Model registry
Operate
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor 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
hivemind
Commits
b5c59ad2
Commit
b5c59ad2
authored
7 years ago
by
roadscape
Browse files
Options
Downloads
Patches
Plain Diff
batching compatible w get_content
parent
1fbc3b0b
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
hive/indexer/http_client.py
+4
-4
4 additions, 4 deletions
hive/indexer/http_client.py
hive/indexer/utils.py
+5
-5
5 additions, 5 deletions
hive/indexer/utils.py
with
9 additions
and
9 deletions
hive/indexer/http_client.py
+
4
−
4
View file @
b5c59ad2
...
...
@@ -17,7 +17,7 @@ from urllib3.connection import HTTPConnection
from
urllib3.exceptions
import
MaxRetryError
,
ReadTimeoutError
,
ProtocolError
logger
=
logging
.
getLogger
(
__name__
)
logger
.
setLevel
(
logging
.
DEBU
G
)
logger
.
setLevel
(
logging
.
WARNIN
G
)
class
RPCError
(
Exception
):
pass
...
...
@@ -109,7 +109,7 @@ class HttpClient(object):
self
.
request
=
None
self
.
next_node
()
log_level
=
kwargs
.
get
(
'
log_level
'
,
logging
.
DEBU
G
)
log_level
=
kwargs
.
get
(
'
log_level
'
,
logging
.
WARNIN
G
)
logger
.
setLevel
(
log_level
)
def
next_node
(
self
):
...
...
@@ -256,9 +256,9 @@ class HttpClient(object):
batch_requests
=
({
"
method
"
:
name
,
"
params
"
:
[
i
]
,
"
params
"
:
i
,
"
jsonrpc
"
:
"
2.0
"
,
"
id
"
:
i
"
id
"
:
0
}
for
i
in
params
)
...
...
This diff is collapsed.
Click to expand it.
hive/indexer/utils.py
+
5
−
5
View file @
b5c59ad2
...
...
@@ -43,7 +43,7 @@ class SteemAdapter:
return
self
.
__exec
(
'
get_accounts
'
,
accounts
)
def
get_content_batch
(
self
,
tuples
):
return
self
.
__exec_
multi
(
'
get_content
'
,
tuples
)
return
self
.
__exec_
batch
(
'
get_content
'
,
tuples
)
def
get_block
(
self
,
num
):
return
self
.
__exec
(
'
get_block
'
,
num
)
...
...
@@ -69,10 +69,10 @@ class SteemAdapter:
blocks
=
{}
while
missing
:
for
block
in
self
.
__exec_batch
(
'
get_block
'
,
missing
):
for
block
in
self
.
__exec_batch
(
'
get_block
'
,
[[
i
]
for
i
in
missing
]
):
blocks
[
int
(
block
[
'
block_id
'
][:
8
],
base
=
16
)]
=
block
available
=
set
(
blocks
.
keys
())
missing
=
required
-
available
available
=
set
(
blocks
.
keys
())
missing
=
required
-
available
if
missing
:
print
(
"
WARNING: API missed blocks {}
"
.
format
(
missing
))
time
.
sleep
(
3
)
...
...
@@ -86,4 +86,4 @@ class SteemAdapter:
return
self
.
_client
.
exec
(
method
,
*
params
)
def
__exec_batch
(
self
,
method
,
params
):
return
self
.
_client
.
exec_batch
(
method
,
params
)
\ No newline at end of file
return
self
.
_client
.
exec_batch
(
method
,
params
)
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