fix startup migration fail with unavailable shards

pull/445/head
simon 2 years ago
parent ee568534f6
commit 22ef33c6ca
No known key found for this signature in database
GPG Key ID: 2C15AA5E89985DD4

@ -4,6 +4,7 @@ Functionality:
- Apply migrations
"""
from time import sleep
import os
from django.core.management.base import BaseCommand, CommandError
@ -151,6 +152,12 @@ class Command(BaseCommand):
for index_name in index_list:
path = f"{index_name}/_update_by_query"
response, status_code = ElasticWrap(path).post(data=data)
if status_code == 503:
message = f" 🗙 {index_name} retry failed migration."
self.stdout.write(self.style.ERROR(message))
sleep(10)
response, status_code = ElasticWrap(path).post(data=data)
if status_code == 200:
updated = response.get("updated", 0)
if not updated:

Loading…
Cancel
Save