diff --git a/connectors/services/job_cleanup.py b/connectors/services/job_cleanup.py index 30f412a0f..b603e48cb 100644 --- a/connectors/services/job_cleanup.py +++ b/connectors/services/job_cleanup.py @@ -71,11 +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.es_management_client.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']}") diff --git a/tests/services/test_job_cleanup.py b/tests/services/test_job_cleanup.py index 6308c556b..76698c851 100644 --- a/tests/services/test_job_cleanup.py +++ b/tests/services/test_job_cleanup.py @@ -47,7 +47,6 @@ def mock_sync_job(sync_job_id="1", connector_id="1", index_name="index_name"): @pytest.mark.asyncio @patch("connectors.protocol.SyncJobIndex.delete_jobs") -@patch("connectors.es.management_client.ESManagementClient.delete_indices") @patch("connectors.protocol.SyncJobIndex.idle_jobs") @patch("connectors.protocol.SyncJobIndex.orphaned_jobs") @patch("connectors.protocol.ConnectorIndex.fetch_by_id") @@ -59,7 +58,6 @@ async def test_cleanup_jobs( connector_fetch_by_id, orphaned_jobs, idle_jobs, - delete_indices, delete_jobs, ): existing_index_name = "foo" @@ -77,7 +75,6 @@ async def test_cleanup_jobs( await create_and_run_service(JobCleanUpService, config=CONFIG, stop_after=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(IDLE_JOB_ERROR) connector.sync_done.assert_called_with(job=sync_job)