Skip to content

Commit

Permalink
Minor optimisations
Browse files Browse the repository at this point in the history
  • Loading branch information
artem-shelkovnikov committed Jan 17, 2025
1 parent 1ed28e5 commit df1783c
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 17 deletions.
10 changes: 0 additions & 10 deletions connectors/es/index.py
Original file line number Diff line number Diff line change
Expand Up @@ -219,11 +219,6 @@ async def fetch_by_id(self, doc_id):

async def fetch_response_by_id(self, doc_id):
try:
if not self.serverless:
await self._retrier.execute_with_retry(
partial(self.client.indices.refresh, index=self.index_name)
)

resp = await self._retrier.execute_with_retry(
partial(self.client.get, index=self.index_name, id=doc_id)
)
Expand Down Expand Up @@ -286,11 +281,6 @@ async def get_all_docs(self, query=None, sort=None, page_size=DEFAULT_PAGE_SIZE)
Returns:
Iterator
"""
if not self.serverless:
await self._retrier.execute_with_retry(
partial(self.client.indices.refresh, index=self.index_name)
)

if query is None:
query = {"match_all": {}}

Expand Down
12 changes: 5 additions & 7 deletions connectors/sync_job_runner.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,8 @@

UTF_8 = "utf-8"

JOB_REPORTING_INTERVAL = 10
JOB_CHECK_INTERVAL = 1
JOB_REPORTING_INTERVAL = 15
JOB_CHECK_INTERVAL = 5
ES_ID_SIZE_LIMIT = 512


Expand Down Expand Up @@ -324,11 +324,6 @@ async def _sync_done(self, sync_status, sync_error=None):
}

if await self.reload_sync_job():
if await self.reload_connector():
persisted_stats[
"total_document_count"
] = await self.connector.document_count()

if sync_status == JobStatus.ERROR:
await self.sync_job.fail(sync_error, ingestion_stats=persisted_stats)
elif sync_status == JobStatus.SUSPENDED:
Expand All @@ -339,6 +334,9 @@ async def _sync_done(self, sync_status, sync_error=None):
await self.sync_job.done(ingestion_stats=persisted_stats)

if await self.reload_connector():
persisted_stats[
"total_document_count"
] = await self.connector.document_count()
sync_cursor = (
None
if not self.data_provider # If we failed before initializing the data provider, we don't need to change the cursor
Expand Down

0 comments on commit df1783c

Please sign in to comment.