Cleanup the cleanup tasks
This commit is contained in:
parent
0e2ecab78f
commit
61aff326de
1 changed files with 16 additions and 5 deletions
21
app.py
21
app.py
|
@ -1267,11 +1267,6 @@ def outbox_activity_shares(item_id):
|
|||
@app.route("/admin", methods=["GET"])
|
||||
@login_required
|
||||
def admin():
|
||||
# Setup the cron tasks
|
||||
p.push({}, "/task/cleanup_part_1", schedule="@every 12h")
|
||||
p.push({}, "/task/cleanup_part_2", schedule="@every 12h")
|
||||
p.push({}, "/task/cleanup_part_3", schedule="@every 12h")
|
||||
|
||||
q = {
|
||||
"meta.deleted": False,
|
||||
"meta.undo": False,
|
||||
|
@ -1393,6 +1388,13 @@ def admin_new():
|
|||
@app.route("/admin/notifications")
|
||||
@login_required
|
||||
def admin_notifications():
|
||||
# Setup the cron for deleting old activities
|
||||
p.push({}, "/task/cleanup", schedule="@every 12h")
|
||||
|
||||
# Trigger a cleanup if asked
|
||||
if request.args.get("cleanup"):
|
||||
p.push({}, "/task/cleanup")
|
||||
|
||||
# FIXME(tsileo): show unfollow (performed by the current actor) and liked???
|
||||
mentions_query = {
|
||||
"type": ActivityType.CREATE.value,
|
||||
|
@ -2709,6 +2711,15 @@ def task_post_to_remote_inbox():
|
|||
return ""
|
||||
|
||||
|
||||
@app.route("/task/cleanup", methods=["POST"])
|
||||
def task_cleanup():
|
||||
task = p.parse(request)
|
||||
app.logger.info(f"task={task!r}")
|
||||
p.push({}, "/task/cleanup_part_1")
|
||||
p.push({}, "/task/cleanup_part_2")
|
||||
p.push({}, "/task/cleanup_part_3")
|
||||
|
||||
|
||||
@app.route("/task/cleanup_part_1", methods=["POST"])
|
||||
def task_cleanup_part_1():
|
||||
task = p.parse(request)
|
||||
|
|
Loading…
Reference in a new issue