diff --git a/tubearchivist/home/src/download/queue.py b/tubearchivist/home/src/download/queue.py index 57d520b..6be7f82 100644 --- a/tubearchivist/home/src/download/queue.py +++ b/tubearchivist/home/src/download/queue.py @@ -103,7 +103,7 @@ class PendingInteract: def delete_item(self): """delete single item from pending""" path = f"ta_download/_doc/{self.video_id}" - _, _ = ElasticWrap(path).delete() + _, _ = ElasticWrap(path).delete(refresh=True) def delete_by_status(self): """delete all matching item by status""" diff --git a/tubearchivist/home/src/es/connect.py b/tubearchivist/home/src/es/connect.py index f976943..e61ae14 100644 --- a/tubearchivist/home/src/es/connect.py +++ b/tubearchivist/home/src/es/connect.py @@ -75,8 +75,10 @@ class ElasticWrap: return response.json(), response.status_code - def delete(self, data=False): + def delete(self, data=False, refresh=False): """delete document from es""" + if refresh: + self.url = f"{self.url}/?refresh=true" if data: response = requests.delete(self.url, json=data, auth=self.auth) else: diff --git a/tubearchivist/home/src/index/generic.py b/tubearchivist/home/src/index/generic.py index f384ec7..0940258 100644 --- a/tubearchivist/home/src/index/generic.py +++ b/tubearchivist/home/src/index/generic.py @@ -86,7 +86,7 @@ class YouTubeItem: def del_in_es(self): """delete item from elastic search""" print(f"{self.youtube_id}: delete from es") - _, _ = ElasticWrap(self.es_path).delete() + _, _ = ElasticWrap(self.es_path).delete(refresh=True) class Pagination: