mirror of
https://git.sr.ht/~tsileo/microblog.pub
synced 2024-11-15 11:14:28 +00:00
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"])
|
@app.route("/admin", methods=["GET"])
|
||||||
@login_required
|
@login_required
|
||||||
def admin():
|
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 = {
|
q = {
|
||||||
"meta.deleted": False,
|
"meta.deleted": False,
|
||||||
"meta.undo": False,
|
"meta.undo": False,
|
||||||
|
@ -1393,6 +1388,13 @@ def admin_new():
|
||||||
@app.route("/admin/notifications")
|
@app.route("/admin/notifications")
|
||||||
@login_required
|
@login_required
|
||||||
def admin_notifications():
|
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???
|
# FIXME(tsileo): show unfollow (performed by the current actor) and liked???
|
||||||
mentions_query = {
|
mentions_query = {
|
||||||
"type": ActivityType.CREATE.value,
|
"type": ActivityType.CREATE.value,
|
||||||
|
@ -2709,6 +2711,15 @@ def task_post_to_remote_inbox():
|
||||||
return ""
|
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"])
|
@app.route("/task/cleanup_part_1", methods=["POST"])
|
||||||
def task_cleanup_part_1():
|
def task_cleanup_part_1():
|
||||||
task = p.parse(request)
|
task = p.parse(request)
|
||||||
|
|
Loading…
Reference in a new issue