예제 #1
0
def main(private_key: PrivateKey, state_db: str, matrix_server: List[str],
         accept_disclaimer: bool) -> int:
    """The request collector for the monitoring service."""
    log.info("Starting Raiden Monitoring Request Collector")
    click.secho(MS_DISCLAIMER, fg="yellow")
    if not accept_disclaimer:
        click.confirm(CONFIRMATION_OF_UNDERSTANDING, abort=True)
    if state_db != ":memory:" and not os.path.exists(state_db):
        log.error(
            "Database file from monitoring service not found. Is the monitoring service running?",
            expected_db_path=state_db,
        )
        sys.exit(1)

    database = SharedDatabase(state_db)

    service = RequestCollector(private_key=private_key,
                               state_db=database,
                               matrix_servers=matrix_server)

    service.start()
    service.listen_forever()

    print("Exiting...")
    return 0


if __name__ == "__main__":
    setup_sentry()
    main(auto_envvar_prefix="MSRC")  # pragma: no cover
예제 #2
0
            poll_interval=DEFAULT_POLL_INTERVALL,
            db_filename=state_db,
        )

        api = ServiceApi(
            pathfinding_service=service,
            service_fee=service_fee,
            debug_mode=enable_debug,
            one_to_n_address=contracts[CONTRACT_ONE_TO_N].address,
            operator=operator,
            info_message=info_message,
        )
        api.run(host=host)

        service.run()
    except (KeyboardInterrupt, SystemExit):
        print("Exiting...")
    finally:
        log.info("Stopping Pathfinding Service...")
        if api:
            api.stop()
        if service:
            service.stop()

    return 0


if __name__ == "__main__":
    setup_sentry(enable_flask_integration=True)
    main(auto_envvar_prefix="PFS")  # pragma: no cover