Skip to content

Commit

Permalink
Added populate_existing and skip_locked for with_for_update.
Browse files Browse the repository at this point in the history
  • Loading branch information
Aleksandr Movchan committed Oct 22, 2024
1 parent 1e4f384 commit 836c21c
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions aana/storage/repository/task.py
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,8 @@ def fetch_unprocessed_tasks(self, limit: int | None = None) -> list[TaskEntity]:
)
.order_by(desc(TaskEntity.priority), TaskEntity.created_at)
.limit(limit)
.with_for_update()
.populate_existing()
.with_for_update(skip_locked=True)
.all()
)
for task in tasks:
Expand Down Expand Up @@ -214,7 +215,8 @@ def update_expired_tasks(
TaskEntity.updated_at <= cutoff_time,
),
)
.with_for_update()
.populate_existing()
.with_for_update(skip_locked=True)
.all()
)
for task in tasks:
Expand Down

0 comments on commit 836c21c

Please sign in to comment.