Skip to content
Snippets Groups Projects
Commit 6774e1c4 authored by roadscape's avatar roadscape
Browse files

fix tags test, minor acct bug, conf

parent eb2e76ae
No related branches found
No related tags found
No related merge requests found
......@@ -6,7 +6,6 @@ from collections import OrderedDict
from funcy.seqs import first
import sqlalchemy
from hive.conf import Conf
from hive.utils.stats import Stats
logging.getLogger('sqlalchemy.engine').setLevel(logging.WARNING)
......@@ -21,6 +20,7 @@ class Db:
def instance(cls):
"""Get a lazily-initialized singleton."""
if not cls._instance:
from hive.conf import Conf
url = Conf.get('database_url')
assert url, ('--database-url (or DATABASE_URL env) not specified; '
'e.g. postgresql://user:pass@localhost:5432/hive')
......
......@@ -124,7 +124,7 @@ class Accounts:
@classmethod
def _cache_accounts(cls, accounts, steem, trx=True):
"""Fetch all `accounts` and write to db."""
timer = Timer(len(accounts), 'account', ['rps', 'pps', 'wps'])
timer = Timer(len(accounts), 'account', ['rps', 'wps'])
for name_batch in partition_all(1000, accounts):
cached_at = datetime.now().strftime('%Y-%m-%dT%H:%M:%S')
......
......@@ -11,7 +11,7 @@ from hive.steem.block.stream import BlockStream
class SteemClient:
"""Handles upstream calls to jussi/steemd, with batching and retrying."""
def __init__(self, url, max_batch=500, max_workers=1):
def __init__(self, url='https://api.steemit.com', max_batch=50, max_workers=1):
assert url, 'steem-API endpoint undefined'
assert max_batch > 0 and max_batch <= 5000
assert max_workers > 0 and max_workers <= 64
......
......@@ -57,5 +57,5 @@ async def test_get_trending_tags():
assert full[3] == short[3]
# ensure pagination works
paged = await get_trending_tags(full[2], 2)
paged = await get_trending_tags(full[2]['name'], 2)
assert full[3] == paged[1]
......@@ -40,7 +40,7 @@ async def test_get_content_replies():
replies = await get_content_replies('xeroc', 'python-steem-0-1')
assert replies
assert len(replies) > 0
assert replies[0]['author'] == 'puppies'
assert 'puppies' in [r['author'] for r in replies]
@pytest.mark.asyncio
async def test_nested_query_compat():
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment