Skip to content

Commit

Permalink
type annotations
Browse files Browse the repository at this point in the history
  • Loading branch information
jackrobison committed May 5, 2022
1 parent 6f22767 commit e83c03d
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 5 deletions.
4 changes: 2 additions & 2 deletions scribe/blockchain/service.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
from scribe.schema.url import normalize_name
from scribe.service import BlockchainService
if typing.TYPE_CHECKING:
from scribe.env import Env
from scribe.blockchain.env import BlockchainEnv
from scribe.db.revertable import RevertableOpStack


Expand All @@ -43,7 +43,7 @@ class BlockchainProcessorService(BlockchainService):
"reorg_count", "Number of reorgs", namespace=NAMESPACE
)

def __init__(self, env: 'Env'):
def __init__(self, env: 'BlockchainEnv'):
super().__init__(env, secondary_name='', thread_workers=1, thread_prefix='block-processor')
self.daemon = LBCDaemon(env.coin, env.daemon_url)
self.mempool = MemPool(env.coin, self.db)
Expand Down
5 changes: 4 additions & 1 deletion scribe/elasticsearch/service.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,13 +13,16 @@
from scribe.elasticsearch.search import IndexVersionMismatch, expand_query
from scribe.elasticsearch.constants import ALL_FIELDS, INDEX_DEFAULT_SETTINGS
from scribe.elasticsearch.fast_ar_trending import FAST_AR_TRENDING_SCRIPT
if typing.TYPE_CHECKING:
from scribe.elasticsearch.env import ElasticEnv


class ElasticSyncService(BlockchainReaderService):
VERSION = 1

def __init__(self, env):
def __init__(self, env: 'ElasticEnv'):
super().__init__(env, 'lbry-elastic-writer', thread_workers=1, thread_prefix='lbry-elastic-writer')
self.env = env
# self._refresh_interval = 0.1
self._task = None
self.index = self.env.es_index_prefix + 'claims'
Expand Down
7 changes: 5 additions & 2 deletions scribe/hub/service.py
Original file line number Diff line number Diff line change
@@ -1,17 +1,20 @@
import time

import typing
import asyncio
from scribe.blockchain.daemon import LBCDaemon
from scribe.hub.session import SessionManager
from scribe.hub.mempool import HubMemPool
from scribe.hub.udp import StatusServer
from scribe.service import BlockchainReaderService
from scribe.elasticsearch import ElasticNotifierClientProtocol
if typing.TYPE_CHECKING:
from scribe.hub.env import ServerEnv


class HubServerService(BlockchainReaderService):
def __init__(self, env):
def __init__(self, env: 'ServerEnv'):
super().__init__(env, 'lbry-reader', thread_workers=max(1, env.max_query_workers), thread_prefix='hub-worker')
self.env = env
self.notifications_to_send = []
self.mempool_notifications = set()
self.status_server = StatusServer()
Expand Down

0 comments on commit e83c03d

Please sign in to comment.