Skip to content

Conversation

@Nayana-R-Gowda
Copy link
Collaborator

@Nayana-R-Gowda Nayana-R-Gowda commented Jan 5, 2026

Signed-off-by: NAYANAR nayana.r7813@gmail.com
closes #1693
This change introduces a centralized, priority-based background task scheduler to coordinate all periodic tasks.

I validated the behavior using controlled asyncio tests that demonstrate:

elimination of overlapping background task execution

strict priority ordering (CRITICAL → HIGH → NORMAL → LOW)

enforced concurrency limits via a semaphore

predictable execution under load

Compared to the previous timer-based approach, this prevents DB connection spikes, reduces resource contention, and ensures critical system tasks are not delayed by housekeeping jobs.

@jonpspri
Copy link
Collaborator

Hello @Nayana-R-Gowda and thank you for the PR. Please move creation of the TaskScheduler class from the services/init.py file into utils/task_scheduler.py . Once the imports have been synchronized that may clear up the linting issues.

Please also be sure to rebase against the upstream repository and sign your commits. You may wish to squash commits to date when you rebase.

@Nayana-R-Gowda Nayana-R-Gowda marked this pull request as draft January 19, 2026 06:36
Signed-off-by: NAYANAR <nayana.r7813@gmail.com>
Signed-off-by: NAYANAR <nayana.r7813@gmail.com>
Signed-off-by: NAYANAR <nayana.r7813@gmail.com>
Signed-off-by: NAYANAR <nayana.r7813@gmail.com>
@Nayana-R-Gowda Nayana-R-Gowda force-pushed the 1693_Optimize_Background_Task_Execution branch from 94650e1 to 3023720 Compare January 19, 2026 07:28
…heduler.py

Signed-off-by: NAYANAR <nayana.r7813@gmail.com>
Signed-off-by: NAYANAR <nayana.r7813@gmail.com>
Signed-off-by: NAYANAR <nayana.r7813@gmail.com>
Signed-off-by: NAYANAR <nayana.r7813@gmail.com>
Signed-off-by: NAYANAR <nayana.r7813@gmail.com>
Signed-off-by: NAYANAR <nayana.r7813@gmail.com>
Signed-off-by: NAYANAR <nayana.r7813@gmail.com>
@Nayana-R-Gowda Nayana-R-Gowda marked this pull request as ready for review January 19, 2026 16:46
Signed-off-by: NAYANAR <nayana.r7813@gmail.com>
Signed-off-by: NAYANAR <nayana.r7813@gmail.com>
@crivetimihai crivetimihai self-assigned this Jan 19, 2026
@crivetimihai crivetimihai added this to the Release 1.0.0-RC1 milestone Jan 20, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[PERFORMANCE]: Optimize Background Task Execution

4 participants