forked from forks/microblog.pub
Fix CI
This commit is contained in:
parent
af46e914bb
commit
6e7bfdd5c1
3 changed files with 24 additions and 7 deletions
26
app.py
26
app.py
|
@ -2252,7 +2252,7 @@ def task_t2():
|
||||||
|
|
||||||
|
|
||||||
@app.route("/task/fetch_og_meta", methods=["POST"])
|
@app.route("/task/fetch_og_meta", methods=["POST"])
|
||||||
def task_fetch_og_metadata():
|
def task_fetch_og_meta():
|
||||||
task = p.parse(request)
|
task = p.parse(request)
|
||||||
app.logger.info(f"task={task!r}")
|
app.logger.info(f"task={task!r}")
|
||||||
iri = task.payload
|
iri = task.payload
|
||||||
|
@ -2287,6 +2287,8 @@ def task_fetch_og_metadata():
|
||||||
app.logger.exception(f"failed to fetch OG metadata for {iri}")
|
app.logger.exception(f"failed to fetch OG metadata for {iri}")
|
||||||
abort(500)
|
abort(500)
|
||||||
|
|
||||||
|
return ""
|
||||||
|
|
||||||
|
|
||||||
@app.route("/task/cache_object", methods=["POST"])
|
@app.route("/task/cache_object", methods=["POST"])
|
||||||
def task_cache_object():
|
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}")
|
app.logger.exception(f"failed to post to remote inbox for {iri}")
|
||||||
abort(500)
|
abort(500)
|
||||||
|
|
||||||
|
return ""
|
||||||
|
|
||||||
|
|
||||||
@app.route("/task/finish_post_to_inbox", methods=["POST"]) # noqa: C901
|
@app.route("/task/finish_post_to_inbox", methods=["POST"]) # noqa: C901
|
||||||
def task_finish_post_to_inbox():
|
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}")
|
app.logger.exception(f"failed to cache attachments for {iri}")
|
||||||
abort(500)
|
abort(500)
|
||||||
|
|
||||||
|
return ""
|
||||||
|
|
||||||
|
|
||||||
def post_to_outbox(activity: ap.BaseActivity) -> str:
|
def post_to_outbox(activity: ap.BaseActivity) -> str:
|
||||||
if activity.has_type(ap.CREATE_TYPES):
|
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}")
|
app.logger.exception(f"failed to cache attachments for {iri}")
|
||||||
abort(500)
|
abort(500)
|
||||||
|
|
||||||
|
return ""
|
||||||
|
|
||||||
|
|
||||||
@app.route("/task/cache_actor", methods=["POST"])
|
@app.route("/task/cache_actor", methods=["POST"])
|
||||||
def task_cache_actor():
|
def task_cache_actor() -> str:
|
||||||
task = p.parse(request)
|
task = p.parse(request)
|
||||||
app.logger.info(f"task={task!r}")
|
app.logger.info(f"task={task!r}")
|
||||||
iri, also_cache_attachments = (
|
iri, also_cache_attachments = (
|
||||||
|
@ -2558,7 +2566,7 @@ def task_cache_actor():
|
||||||
app.logger.info(f"activity={activity!r}")
|
app.logger.info(f"activity={activity!r}")
|
||||||
|
|
||||||
if activity.has_type(ap.ActivityType.CREATE):
|
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]):
|
if activity.has_type([ap.ActivityType.LIKE, ap.ActivityType.ANNOUNCE]):
|
||||||
Tasks.cache_object(iri)
|
Tasks.cache_object(iri)
|
||||||
|
@ -2606,6 +2614,8 @@ def task_cache_actor():
|
||||||
app.logger.exception(f"failed to cache actor for {iri}")
|
app.logger.exception(f"failed to cache actor for {iri}")
|
||||||
abort(500)
|
abort(500)
|
||||||
|
|
||||||
|
return ""
|
||||||
|
|
||||||
|
|
||||||
@app.route("/task/process_new_activity", methods=["POST"]) # noqa:c901
|
@app.route("/task/process_new_activity", methods=["POST"]) # noqa:c901
|
||||||
def task_process_new_activity():
|
def task_process_new_activity():
|
||||||
|
@ -2711,8 +2721,10 @@ def task_process_new_activity():
|
||||||
app.logger.exception(f"failed to process new activity {iri}")
|
app.logger.exception(f"failed to process new activity {iri}")
|
||||||
abort(500)
|
abort(500)
|
||||||
|
|
||||||
|
return ""
|
||||||
|
|
||||||
@app.route("/task/forward_activity")
|
|
||||||
|
@app.route("/task/forward_activity", methods=["POST"])
|
||||||
def task_forward_activity():
|
def task_forward_activity():
|
||||||
task = p.parse(request)
|
task = p.parse(request)
|
||||||
app.logger.info(f"task={task!r}")
|
app.logger.info(f"task={task!r}")
|
||||||
|
@ -2730,8 +2742,10 @@ def task_forward_activity():
|
||||||
app.logger.exception("task failed")
|
app.logger.exception("task failed")
|
||||||
abort(500)
|
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():
|
def task_post_to_remote_inbox():
|
||||||
task = p.parse(request)
|
task = p.parse(request)
|
||||||
app.logger.info(f"task={task!r}")
|
app.logger.info(f"task={task!r}")
|
||||||
|
@ -2766,3 +2780,5 @@ def task_post_to_remote_inbox():
|
||||||
return ""
|
return ""
|
||||||
|
|
||||||
abort(500)
|
abort(500)
|
||||||
|
|
||||||
|
return ""
|
||||||
|
|
2
run.sh
2
run.sh
|
@ -1,3 +1,3 @@
|
||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
python -c "import config; config.create_indexes()"
|
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
|
||||||
|
|
|
@ -19,7 +19,7 @@ class Instance(object):
|
||||||
def __init__(self, name, host_url, docker_url=None):
|
def __init__(self, name, host_url, docker_url=None):
|
||||||
self.host_url = host_url
|
self.host_url = host_url
|
||||||
self.docker_url = docker_url or host_url
|
self.docker_url = docker_url or host_url
|
||||||
self._create_delay = 12
|
self._create_delay = 60
|
||||||
with open(
|
with open(
|
||||||
os.path.join(
|
os.path.join(
|
||||||
os.path.dirname(os.path.abspath(__file__)),
|
os.path.dirname(os.path.abspath(__file__)),
|
||||||
|
@ -50,6 +50,7 @@ class Instance(object):
|
||||||
|
|
||||||
def debug(self):
|
def debug(self):
|
||||||
"""Returns the debug infos (number of items in the inbox/outbox."""
|
"""Returns the debug infos (number of items in the inbox/outbox."""
|
||||||
|
time.sleep(self._create_delay)
|
||||||
resp = requests.get(
|
resp = requests.get(
|
||||||
f"{self.host_url}/api/debug",
|
f"{self.host_url}/api/debug",
|
||||||
headers={**self._auth_headers, "Accept": "application/json"},
|
headers={**self._auth_headers, "Accept": "application/json"},
|
||||||
|
|
Loading…
Reference in a new issue