From b7681b3a02e62e0e5da78c5b3b3473d45b58fcd9 Mon Sep 17 00:00:00 2001 From: Thomas Sileo Date: Fri, 5 Apr 2019 15:14:57 +0200 Subject: [PATCH] Fix CI --- app.py | 26 +++++++++++++++++++++----- run.sh | 2 +- tests/federation_test.py | 3 ++- 3 files changed, 24 insertions(+), 7 deletions(-) diff --git a/app.py b/app.py index c9ac063..34894a6 100644 --- a/app.py +++ b/app.py @@ -2252,7 +2252,7 @@ def task_t2(): @app.route("/task/fetch_og_meta", methods=["POST"]) -def task_fetch_og_metadata(): +def task_fetch_og_meta(): task = p.parse(request) app.logger.info(f"task={task!r}") iri = task.payload @@ -2287,6 +2287,8 @@ def task_fetch_og_metadata(): app.logger.exception(f"failed to fetch OG metadata for {iri}") abort(500) + return "" + @app.route("/task/cache_object", methods=["POST"]) def task_cache_object(): @@ -2405,6 +2407,8 @@ def task_finish_post_to_outbox(): app.logger.exception(f"failed to post to remote inbox for {iri}") abort(500) + return "" + @app.route("/task/finish_post_to_inbox", methods=["POST"]) # noqa: C901 def task_finish_post_to_inbox(): @@ -2447,6 +2451,8 @@ def task_finish_post_to_inbox(): app.logger.exception(f"failed to cache attachments for {iri}") abort(500) + return "" + def post_to_outbox(activity: ap.BaseActivity) -> str: if activity.has_type(ap.CREATE_TYPES): @@ -2544,9 +2550,11 @@ def task_cache_attachments(): app.logger.exception(f"failed to cache attachments for {iri}") abort(500) + return "" + @app.route("/task/cache_actor", methods=["POST"]) -def task_cache_actor(): +def task_cache_actor() -> str: task = p.parse(request) app.logger.info(f"task={task!r}") iri, also_cache_attachments = ( @@ -2558,7 +2566,7 @@ def task_cache_actor(): app.logger.info(f"activity={activity!r}") if activity.has_type(ap.ActivityType.CREATE): - Tasks.fetch_og_metadata(iri) + Tasks.fetch_og_meta(iri) if activity.has_type([ap.ActivityType.LIKE, ap.ActivityType.ANNOUNCE]): Tasks.cache_object(iri) @@ -2606,6 +2614,8 @@ def task_cache_actor(): app.logger.exception(f"failed to cache actor for {iri}") abort(500) + return "" + @app.route("/task/process_new_activity", methods=["POST"]) # noqa:c901 def task_process_new_activity(): @@ -2711,8 +2721,10 @@ def task_process_new_activity(): app.logger.exception(f"failed to process new activity {iri}") abort(500) + return "" -@app.route("/task/forward_activity") + +@app.route("/task/forward_activity", methods=["POST"]) def task_forward_activity(): task = p.parse(request) app.logger.info(f"task={task!r}") @@ -2730,8 +2742,10 @@ def task_forward_activity(): app.logger.exception("task failed") abort(500) + return "" -@app.route("/task/post_to_remote_inbox") + +@app.route("/task/post_to_remote_inbox", methods=["POST"]) def task_post_to_remote_inbox(): task = p.parse(request) app.logger.info(f"task={task!r}") @@ -2766,3 +2780,5 @@ def task_post_to_remote_inbox(): return "" abort(500) + + return "" diff --git a/run.sh b/run.sh index a29f5fc..a7eef03 100755 --- a/run.sh +++ b/run.sh @@ -1,3 +1,3 @@ #!/bin/bash python -c "import config; config.create_indexes()" -gunicorn -t 300 -w 2 -b 0.0.0.0:5005 --log-level debug app:app +gunicorn -t 300 -w 5 -b 0.0.0.0:5005 --log-level debug app:app diff --git a/tests/federation_test.py b/tests/federation_test.py index 20569bb..bdaf58d 100644 --- a/tests/federation_test.py +++ b/tests/federation_test.py @@ -19,7 +19,7 @@ class Instance(object): def __init__(self, name, host_url, docker_url=None): self.host_url = host_url self.docker_url = docker_url or host_url - self._create_delay = 12 + self._create_delay = 60 with open( os.path.join( os.path.dirname(os.path.abspath(__file__)), @@ -50,6 +50,7 @@ class Instance(object): def debug(self): """Returns the debug infos (number of items in the inbox/outbox.""" + time.sleep(self._create_delay) resp = requests.get( f"{self.host_url}/api/debug", headers={**self._auth_headers, "Accept": "application/json"},