def syncback_service(): from inbox.transactions.actions import SyncbackService s = SyncbackService(poll_interval=0, retry_interval=0) s.start() yield s s.stop() s.join()
def start(port, start_syncback, enable_tracer, enable_profiler): # We need to import this down here, because this in turn imports # ignition.engine, which has to happen *after* we read any config overrides # for the database parameters. Boo for imports with side-effects. from inbox.api.srv import app if start_syncback: # start actions service from inbox.transactions.actions import SyncbackService if enable_profiler: inbox_config["DEBUG_PROFILING_ON"] = True enable_profiler_api = inbox_config.get("DEBUG_PROFILING_ON") syncback = SyncbackService(0, 0, 1) profiling_frontend = SyncbackHTTPFrontend( int(port) + 1, enable_tracer, enable_profiler_api) profiling_frontend.start() syncback.start() nylas_logger = get_logger() http_server = WSGIServer(("", int(port)), app, log=nylas_logger, handler_class=NylasWSGIHandler) nylas_logger.info("Starting API server", port=port) http_server.serve_forever() if start_syncback: syncback.join()
def syncback_service(): from inbox.transactions.actions import SyncbackService s = SyncbackService(poll_interval=0, retry_interval=0) s.start() yield s s.stop() s.join()
def start(): # Start the syncback service, and just hang out forever syncback = SyncbackService(syncback_id, process_num, total_processes) if enable_profiler: inbox_config["DEBUG_PROFILING_ON"] = True port = 16384 + process_num enable_profiler_api = inbox_config.get("DEBUG_PROFILING_ON") frontend = SyncbackHTTPFrontend(port, enable_tracer, enable_profiler_api) frontend.start() syncback.start() syncback.join()