示例#1
0
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()
示例#2
0
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()
示例#3
0
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()
示例#4
0
文件: base.py 项目: GEverding/inbox
def syncback_service():
    # aggressive=False used to avoid AttributeError in other tests, see
    # https://groups.google.com/forum/#!topic/gevent/IzWhGQHq7n0
    # TODO(emfree): It's totally whack that monkey-patching here would affect
    # other tests. Can we make this not happen?
    monkey.patch_all(aggressive=False)
    from inbox.transactions.actions import SyncbackService
    s = SyncbackService(poll_interval=0, retry_interval=0)
    s.start()
    yield s
    s.stop()
示例#5
0
def syncback_service():
    # aggressive=False used to avoid AttributeError in other tests, see
    # https://groups.google.com/forum/#!topic/gevent/IzWhGQHq7n0
    # TODO(emfree): It's totally whack that monkey-patching here would affect
    # other tests. Can we make this not happen?
    monkey.patch_all(aggressive=False)
    from inbox.transactions.actions import SyncbackService
    s = SyncbackService(poll_interval=0.1)
    s.start()
    yield s
    s.stop()
示例#6
0
    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()
示例#7
0
文件: base.py 项目: AmyWeiner/inbox
def mock_syncback_service():
    """Running SyncbackService with a mock queue."""
    from inbox.transactions.actions import SyncbackService
    from gevent import monkey
    # aggressive=False used to avoid AttributeError in other tests, see
    # https://groups.google.com/forum/#!topic/gevent/IzWhGQHq7n0
    # TODO(emfree): It's totally whack that monkey-patching here would affect
    # other tests. Can we make this not happen?
    monkey.patch_all(aggressive=False)
    s = SyncbackService(poll_interval=0)
    s.queue = MockQueue()
    s.start()
    gevent.sleep()
    assert len(s.queue) == 0
    yield s
    kill_greenlets()