mirror of
https://github.com/danswer-ai/danswer.git
synced 2025-04-08 03:48:14 +02:00
parent
b952dbef42
commit
f2e8680955
@ -118,19 +118,19 @@ def _run_indexing(
|
||||
db_cc_pair = index_attempt.connector_credential_pair
|
||||
db_connector = index_attempt.connector_credential_pair.connector
|
||||
db_credential = index_attempt.connector_credential_pair.credential
|
||||
earliest_index_time = (
|
||||
db_connector.indexing_start.timestamp() if db_connector.indexing_start else 0
|
||||
)
|
||||
|
||||
last_successful_index_time = (
|
||||
db_connector.indexing_start.timestamp()
|
||||
if index_attempt.from_beginning and db_connector.indexing_start is not None
|
||||
else (
|
||||
0.0
|
||||
if index_attempt.from_beginning
|
||||
else get_last_successful_attempt_time(
|
||||
connector_id=db_connector.id,
|
||||
credential_id=db_credential.id,
|
||||
search_settings=index_attempt.search_settings,
|
||||
db_session=db_session,
|
||||
)
|
||||
earliest_index_time
|
||||
if index_attempt.from_beginning
|
||||
else get_last_successful_attempt_time(
|
||||
connector_id=db_connector.id,
|
||||
credential_id=db_credential.id,
|
||||
earliest_index=earliest_index_time,
|
||||
search_settings=index_attempt.search_settings,
|
||||
db_session=db_session,
|
||||
)
|
||||
)
|
||||
|
||||
|
@ -159,6 +159,7 @@ def get_connector_credential_pair_from_id(
|
||||
def get_last_successful_attempt_time(
|
||||
connector_id: int,
|
||||
credential_id: int,
|
||||
earliest_index: float,
|
||||
search_settings: SearchSettings,
|
||||
db_session: Session,
|
||||
) -> float:
|
||||
@ -172,7 +173,7 @@ def get_last_successful_attempt_time(
|
||||
connector_credential_pair is None
|
||||
or connector_credential_pair.last_successful_index_time is None
|
||||
):
|
||||
return 0.0
|
||||
return earliest_index
|
||||
|
||||
return connector_credential_pair.last_successful_index_time.timestamp()
|
||||
|
||||
@ -192,11 +193,9 @@ def get_last_successful_attempt_time(
|
||||
.order_by(IndexAttempt.time_started.desc())
|
||||
.first()
|
||||
)
|
||||
|
||||
if not attempt or not attempt.time_started:
|
||||
connector = fetch_connector_by_id(connector_id, db_session)
|
||||
if connector and connector.indexing_start:
|
||||
return connector.indexing_start.timestamp()
|
||||
return 0.0
|
||||
return earliest_index
|
||||
|
||||
return attempt.time_started.timestamp()
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user