mirror of https://github.com/langgenius/dify.git
rename the get_runs_batch_for_cleanup
This commit is contained in:
parent
60288d1fd7
commit
03993ed4f7
|
|
@ -253,7 +253,7 @@ class APIWorkflowRunRepository(WorkflowExecutionRepository, Protocol):
|
|||
"""
|
||||
...
|
||||
|
||||
def get_runs_batch_for_cleanup(
|
||||
def get_runs_batch_by_time_range(
|
||||
self,
|
||||
start_after: datetime | None,
|
||||
end_before: datetime,
|
||||
|
|
@ -261,7 +261,7 @@ class APIWorkflowRunRepository(WorkflowExecutionRepository, Protocol):
|
|||
batch_size: int,
|
||||
) -> Sequence[WorkflowRun]:
|
||||
"""
|
||||
Fetch a batch of workflow runs within a time window using keyset pagination for cleanup.
|
||||
Fetch a batch of workflow runs within a time window using keyset pagination.
|
||||
"""
|
||||
...
|
||||
|
||||
|
|
|
|||
|
|
@ -323,7 +323,7 @@ class DifyAPISQLAlchemyWorkflowRunRepository(APIWorkflowRunRepository):
|
|||
logger.info("Total deleted %s workflow runs for app %s", total_deleted, app_id)
|
||||
return total_deleted
|
||||
|
||||
def get_runs_batch_for_cleanup(
|
||||
def get_runs_batch_by_time_range(
|
||||
self,
|
||||
start_after: datetime | None,
|
||||
end_before: datetime,
|
||||
|
|
|
|||
|
|
@ -60,7 +60,7 @@ class WorkflowRunCleanup:
|
|||
last_seen: tuple[datetime.datetime, str] | None = None
|
||||
|
||||
while True:
|
||||
run_rows = self.repo.get_runs_batch_for_cleanup(
|
||||
run_rows = self.repo.get_runs_batch_by_time_range(
|
||||
start_after=self.window_start,
|
||||
end_before=self.window_end,
|
||||
last_seen=last_seen,
|
||||
|
|
|
|||
|
|
@ -105,15 +105,15 @@ class TestDifyAPISQLAlchemyWorkflowRunRepository:
|
|||
return pause
|
||||
|
||||
|
||||
class TestGetRunsBatchForCleanup(TestDifyAPISQLAlchemyWorkflowRunRepository):
|
||||
def test_get_runs_batch_for_cleanup_filters_terminal_statuses(
|
||||
class TestGetRunsBatchByTimeRange(TestDifyAPISQLAlchemyWorkflowRunRepository):
|
||||
def test_get_runs_batch_by_time_range_filters_terminal_statuses(
|
||||
self, repository: DifyAPISQLAlchemyWorkflowRunRepository, mock_session: Mock
|
||||
):
|
||||
scalar_result = Mock()
|
||||
scalar_result.all.return_value = []
|
||||
mock_session.scalars.return_value = scalar_result
|
||||
|
||||
repository.get_runs_batch_for_cleanup(
|
||||
repository.get_runs_batch_by_time_range(
|
||||
start_after=None,
|
||||
end_before=datetime(2024, 1, 1),
|
||||
last_seen=None,
|
||||
|
|
|
|||
|
|
@ -29,7 +29,7 @@ class FakeRepo:
|
|||
"pause_reasons": 0,
|
||||
}
|
||||
|
||||
def get_runs_batch_for_cleanup(
|
||||
def get_runs_batch_by_time_range(
|
||||
self,
|
||||
start_after: datetime.datetime | None,
|
||||
end_before: datetime.datetime,
|
||||
|
|
|
|||
Loading…
Reference in New Issue