Invert pruning exit codes

pull/675/head
Andrew Godwin 2023-12-01 00:03:09 -07:00
rodzic 5f28d702f8
commit 837320f461
3 zmienionych plików z 7 dodań i 5 usunięć

Wyświetl plik

@ -73,10 +73,11 @@ class Command(BaseCommand):
# Delete them
if not final_post_ids:
sys.exit(1)
sys.exit(0)
print("Deleting...")
_, deleted = Post.objects.filter(id__in=final_post_ids).delete()
print("Deleted:")
for model, model_deleted in deleted.items():
print(f" {model}: {model_deleted}")
sys.exit(1)

Wyświetl plik

@ -128,11 +128,11 @@ Identity pruning removes any identity that isn't:
* A liker or booster of a local post
We recommend you run the pruning commands on a scheduled basis (i.e. like
a cronjob). They will return a ``0`` exit code if they deleted something and
a ``1`` exit code if they found nothing to delete, if you want to put them in
a cronjob). They will return a ``1`` exit code if they deleted something and
a ``0`` exit code if they found nothing to delete, if you want to put them in
a loop that runs until deletion is complete::
while ./manage.py pruneposts; do sleep 1; done
until ./manage.py pruneposts; do sleep 1; done
Caching

Wyświetl plik

@ -43,7 +43,7 @@ class Command(BaseCommand):
identity_ids = identities.values_list("id", flat=True)
print(f" found {len(identity_ids)}")
if not identity_ids:
sys.exit(1)
sys.exit(0)
# Delete them
print("Deleting...")
@ -51,3 +51,4 @@ class Command(BaseCommand):
print("Deleted:")
for model, model_deleted in deleted.items():
print(f" {model}: {model_deleted}")
sys.exit(1)