Skip to content

Commit

Permalink
Merge pull request #677 from Ilhasoft/staging
Browse files Browse the repository at this point in the history
Staging
  • Loading branch information
helllllllder committed Nov 23, 2021
2 parents 47d081f + 1cf64b9 commit e1ea7e9
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 0 deletions.
12 changes: 12 additions & 0 deletions bothub/common/signals.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,3 +15,15 @@ def handle_save(self, sender, instance, **kwargs):
"es_handle_save", args=[instance.pk, app_label, model_name]
)
)

def handle_pre_delete(self, sender, instance, **kwargs):
"""
Logs deletions are now handled in delete_nlp_logs task
"""
pass

def handle_delete(self, sender, instance, **kwargs):
"""
Logs deletions are now handled in delete_nlp_logs task
"""
pass
2 changes: 2 additions & 0 deletions bothub/common/tasks.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
from bothub import translate
from bothub.api.grpc.connect_grpc_client import ConnectGRPCClient
from bothub.celery import app
from bothub.common.documents import RepositoryNLPLogDocument
from bothub.common.models import (
RepositoryQueueTask,
RepositoryReports,
Expand Down Expand Up @@ -270,6 +271,7 @@ def delete_nlp_logs():
max_id = batch[-1].id
with transaction.atomic():
for log in batch:
RepositoryNLPLogDocument.search().query("match", pk=log.pk).delete()
log.delete()

num_updated += len(batch)
Expand Down

0 comments on commit e1ea7e9

Please sign in to comment.