Skip to content

Commit

Permalink
Remove automatically deleting indices for orphaned jobs (#2038)
Browse files Browse the repository at this point in the history
(cherry picked from commit 2ecbfed)

# Conflicts:
#	connectors/services/job_cleanup.py
#	tests/services/test_job_cleanup.py
  • Loading branch information
sphilipse committed Jan 9, 2024
1 parent f91f184 commit 5e8ddb5
Show file tree
Hide file tree
Showing 2 changed files with 0 additions and 7 deletions.
4 changes: 0 additions & 4 deletions connectors/services/job_cleanup.py
Original file line number Diff line number Diff line change
Expand Up @@ -71,10 +71,6 @@ async def _process_orphaned_jobs(self):
logger.debug("No orphaned jobs found, skipping cleaning")
return

# delete content indices in case they are re-created by sync job
if len(content_indices) > 0:
await self.sync_job_index.delete_indices(indices=list(content_indices))
result = await self.sync_job_index.delete_jobs(job_ids=job_ids)
if len(result["failures"]) > 0:
logger.error(f"Error found when deleting jobs: {result['failures']}")
logger.info(
Expand Down
3 changes: 0 additions & 3 deletions tests/services/test_job_cleanup.py
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,6 @@ async def _terminate():

@pytest.mark.asyncio
@patch("connectors.protocol.SyncJobIndex.delete_jobs")
@patch("connectors.protocol.SyncJobIndex.delete_indices")
@patch("connectors.protocol.SyncJobIndex.idle_jobs")
@patch("connectors.protocol.SyncJobIndex.orphaned_jobs")
@patch("connectors.protocol.ConnectorIndex.fetch_by_id")
Expand All @@ -71,7 +70,6 @@ async def test_cleanup_jobs(
connector_fetch_by_id,
orphaned_jobs,
idle_jobs,
delete_indices,
delete_jobs,
):
existing_index_name = "foo"
Expand All @@ -90,7 +88,6 @@ async def test_cleanup_jobs(
service = create_service()
await run_service_with_stop_after(service, 0.1)

delete_indices.assert_called_with(indices=[to_be_deleted_index_name])
delete_jobs.assert_called_with(job_ids=[sync_job.id, another_sync_job.id])
sync_job.fail.assert_called_with(message=IDLE_JOB_ERROR)
connector.sync_done.assert_called_with(job=sync_job)

0 comments on commit 5e8ddb5

Please sign in to comment.