Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

WIP: Minor optimisations to reduce number of ES Calls #3127

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading