Skip to content

Commit

Permalink
Remove execution options in cleanup functions
Browse files Browse the repository at this point in the history
  • Loading branch information
ogabrielluiz committed Nov 19, 2024
1 parent a4336fb commit 13836f3
Showing 1 changed file with 10 additions and 18 deletions.
28 changes: 10 additions & 18 deletions src/backend/base/langflow/services/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -182,16 +182,12 @@ async def clean_transactions(settings_service: SettingsService, session: AsyncSe
"""
try:
# Delete transactions using bulk delete
delete_stmt = (
delete(TransactionTable)
.where(
TransactionTable.id.in_(
select(TransactionTable.id)
.order_by(TransactionTable.timestamp.desc())
.offset(settings_service.settings.max_transactions_to_keep)
)
delete_stmt = delete(TransactionTable).where(
TransactionTable.id.in_(
select(TransactionTable.id)
.order_by(TransactionTable.timestamp.desc())
.offset(settings_service.settings.max_transactions_to_keep)
)
.execution_options(synchronize_session="evaluate")
)

await session.exec(delete_stmt)
Expand All @@ -218,16 +214,12 @@ async def clean_vertex_builds(settings_service: SettingsService, session: AsyncS
"""
try:
# Delete vertex builds using bulk delete
delete_stmt = (
delete(VertexBuildTable)
.where(
VertexBuildTable.id.in_(
select(VertexBuildTable.id)
.order_by(VertexBuildTable.timestamp.desc())
.offset(settings_service.settings.max_vertex_builds_to_keep)
)
delete_stmt = delete(VertexBuildTable).where(
VertexBuildTable.id.in_(
select(VertexBuildTable.id)
.order_by(VertexBuildTable.timestamp.desc())
.offset(settings_service.settings.max_vertex_builds_to_keep)
)
.execution_options(synchronize_session="evaluate")
)

await session.exec(delete_stmt)
Expand Down

0 comments on commit 13836f3

Please sign in to comment.