File tree Expand file tree Collapse file tree 3 files changed +18
-13
lines changed Expand file tree Collapse file tree 3 files changed +18
-13
lines changed Original file line number Diff line number Diff line change @@ -367,21 +367,23 @@ def monitor_ccpair_indexing_taskset(
367
367
368
368
redis_connector_index .reset ()
369
369
370
- # mark the CC Pair as `ACTIVE` if it's not already
370
+ # mark the CC Pair as `ACTIVE` if the attempt was a success and the
371
+ # CC Pair is not active not already
372
+ # This should never technically be in this state, but we'll handle it anyway
373
+ index_attempt = get_index_attempt (db_session , payload .index_attempt_id )
374
+ index_attempt_is_successful = index_attempt and index_attempt .status .is_successful ()
371
375
if (
372
- # it should never technically be in this state, but we'll handle it anyway
373
- cc_pair .status == ConnectorCredentialPairStatus .SCHEDULED
376
+ index_attempt_is_successful
377
+ and cc_pair .status == ConnectorCredentialPairStatus .SCHEDULED
374
378
or cc_pair .status == ConnectorCredentialPairStatus .INITIAL_INDEXING
375
379
):
376
380
cc_pair .status = ConnectorCredentialPairStatus .ACTIVE
377
381
db_session .commit ()
378
382
379
383
# if the index attempt is successful, clear the repeated error state
380
- if cc_pair .in_repeated_error_state :
381
- index_attempt = get_index_attempt (db_session , payload .index_attempt_id )
382
- if index_attempt and index_attempt .status .is_successful ():
383
- cc_pair .in_repeated_error_state = False
384
- db_session .commit ()
384
+ if cc_pair .in_repeated_error_state and index_attempt_is_successful :
385
+ cc_pair .in_repeated_error_state = False
386
+ db_session .commit ()
385
387
386
388
387
389
@shared_task (
Original file line number Diff line number Diff line change @@ -160,11 +160,6 @@ def get_latest_valid_checkpoint(
160
160
f"{ latest_valid_checkpoint_candidate .id } . Previous checkpoint: "
161
161
f"{ previous_checkpoint } "
162
162
)
163
- save_checkpoint (
164
- db_session = db_session ,
165
- index_attempt_id = latest_valid_checkpoint_candidate .id ,
166
- checkpoint = previous_checkpoint ,
167
- )
168
163
return previous_checkpoint
169
164
170
165
Original file line number Diff line number Diff line change @@ -423,6 +423,14 @@ def _run_indexing(
423
423
connector = connector_runner .connector ,
424
424
)
425
425
426
+ # save the initial checkpoint to have a proper record of the
427
+ # "last used checkpoint"
428
+ save_checkpoint (
429
+ db_session = db_session_temp ,
430
+ index_attempt_id = index_attempt_id ,
431
+ checkpoint = checkpoint ,
432
+ )
433
+
426
434
unresolved_errors = get_index_attempt_errors_for_cc_pair (
427
435
cc_pair_id = ctx .cc_pair_id ,
428
436
unresolved_only = True ,
You can’t perform that action at this time.
0 commit comments