Skip to content

Commit

Permalink
Merge pull request #77 from TogetherCrew/fix/72-memory-leak
Browse files Browse the repository at this point in the history
fix: trying librabbitmq for celery backend!
  • Loading branch information
cyri113 authored Jun 26, 2024
2 parents 83ff554 + d5e4a4a commit 34c557b
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
4 changes: 3 additions & 1 deletion celery_app/server.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,5 +7,7 @@
host = rabbit_creds["host"]
port = rabbit_creds["port"]

app = Celery("celery_app/tasks", broker=f"pyamqp://{user}:{password}@{host}:{port}//")
app = Celery(
"celery_app/tasks", broker=f"librabbitmq://{user}:{password}@{host}:{port}//"
)
app.autodiscover_tasks(["celery_app"])
4 changes: 3 additions & 1 deletion worker.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,11 +32,13 @@ def query_llm(recieved_data: dict[str, Any]):

community_id = fetch_community_id_by_guild_id(guild_id=recieved_input.guild_id)
logging.info(f"COMMUNITY_ID: {community_id} | Sending job to Celery!")
ask_question_auto_search.delay(
result = ask_question_auto_search.delay(
question=user_input,
community_id=community_id,
bot_given_info=recieved_data,
)
# releasing memory (maybe?)
result.forget()


@backoff.on_exception(
Expand Down

0 comments on commit 34c557b

Please sign in to comment.