khoj icon indicating copy to clipboard operation
khoj copied to clipboard

Fix database connections leakage (#980)

Open rznzippy opened this issue 3 months ago • 0 comments

Description

This pull request addresses a database connection leak caused by django-apscheduler not closing stale connections after task execution. The solution involves wrapping run_with_process_lock with the @close_old_connections decorator provided by django-apscheduler.

For more details, refer to the django-apscheduler documentation on database connections and timeouts.

Changes

  • Added @close_old_connections decorator to run_with_process_lock to ensure database connections are properly closed after each scheduled task.

Related Issue

  • Fixes #980: Database connections not closed after scheduled tasks, leading to connection leakage.

rznzippy avatar Nov 17 '24 18:11 rznzippy