reader/writer move from cli
This commit is contained in:
parent
53e3828965
commit
cfae30a364
1 changed files with 20 additions and 8 deletions
|
@ -2,7 +2,8 @@ import logging
|
||||||
import traceback
|
import traceback
|
||||||
import argparse
|
import argparse
|
||||||
from lbry.wallet.server.env import Env
|
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():
|
def get_argument_parser():
|
||||||
|
@ -20,14 +21,25 @@ def main():
|
||||||
logging.info('lbry.server starting')
|
logging.info('lbry.server starting')
|
||||||
logging.getLogger('aiohttp').setLevel(logging.WARNING)
|
logging.getLogger('aiohttp').setLevel(logging.WARNING)
|
||||||
logging.getLogger('elasticsearch').setLevel(logging.WARNING)
|
logging.getLogger('elasticsearch').setLevel(logging.WARNING)
|
||||||
try:
|
|
||||||
server = Server(Env.from_arg_parser(args))
|
if args.es_mode == 'writer':
|
||||||
server.run()
|
try:
|
||||||
except Exception:
|
block_processor = BlockProcessor(Env.from_arg_parser(args))
|
||||||
traceback.print_exc()
|
block_processor.run()
|
||||||
logging.critical('lbry.server terminated abnormally')
|
except Exception:
|
||||||
|
traceback.print_exc()
|
||||||
|
logging.critical('block processor terminated abnormally')
|
||||||
|
else:
|
||||||
|
logging.info('block processor terminated normally')
|
||||||
else:
|
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__":
|
if __name__ == "__main__":
|
||||||
|
|
Loading…
Reference in a new issue