From cfae30a364e3a57023f75cdceedad12428eaa4eb Mon Sep 17 00:00:00 2001 From: Jack Robison Date: Thu, 6 Jan 2022 12:47:12 -0500 Subject: [PATCH] reader/writer move from cli --- lbry/wallet/server/cli.py | 28 ++++++++++++++++++++-------- 1 file changed, 20 insertions(+), 8 deletions(-) diff --git a/lbry/wallet/server/cli.py b/lbry/wallet/server/cli.py index 74a3d092a..be9dcfef5 100644 --- a/lbry/wallet/server/cli.py +++ b/lbry/wallet/server/cli.py @@ -2,7 +2,8 @@ import logging import traceback import argparse from lbry.wallet.server.env import Env -from lbry.wallet.server.server import Server +from lbry.wallet.server.block_processor import BlockProcessor +from lbry.wallet.server.chain_reader import BlockchainReaderServer def get_argument_parser(): @@ -20,14 +21,25 @@ def main(): logging.info('lbry.server starting') logging.getLogger('aiohttp').setLevel(logging.WARNING) logging.getLogger('elasticsearch').setLevel(logging.WARNING) - try: - server = Server(Env.from_arg_parser(args)) - server.run() - except Exception: - traceback.print_exc() - logging.critical('lbry.server terminated abnormally') + + if args.es_mode == 'writer': + try: + block_processor = BlockProcessor(Env.from_arg_parser(args)) + block_processor.run() + except Exception: + traceback.print_exc() + logging.critical('block processor terminated abnormally') + else: + logging.info('block processor terminated normally') else: - logging.info('lbry.server terminated normally') + try: + server = BlockchainReaderServer(Env.from_arg_parser(args)) + server.run() + except Exception: + traceback.print_exc() + logging.critical('server terminated abnormally') + else: + logging.info('server terminated normally') if __name__ == "__main__":