Skip to content

Commit

Permalink
feat: trying garbage collection in celery post-run
Browse files Browse the repository at this point in the history
might not change anything but worth trying.
  • Loading branch information
amindadgar committed Jun 26, 2024
1 parent 9fac4d1 commit 195873c
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions celery_app/tasks.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
import os
from typing import Any

from celery.signals import task_postrun
from celery_app.server import app
from celery_app.utils.fire_event import job_send
from dotenv import load_dotenv
Expand Down Expand Up @@ -122,4 +123,8 @@ def ask_question_auto_search(
content=response_payload,
)


@task_postrun.connect
def task_postrun_handler(sender=None, **kwargs):
# Trigger garbage collection after each task
gc.collect()

0 comments on commit 195873c

Please sign in to comment.