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

Last update cleared check fix #140

Merged
merged 2 commits into from
Jul 30, 2024
Merged
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
13 changes: 8 additions & 5 deletions dlx_dl/scripts/sync/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -176,10 +176,12 @@ def run(**kwargs):

if last_exported['time'] > dl_last_updated:
flag = 'UPDATE'
print(f'Last update not cleared in DL yet ({flag}) ({args.type}# {last_exported["record_id"]} @ {last_exported["time"]})')
except AssertionError as e:
if last_exported['export_type'] == 'NEW':
# last record not in DL yet
flag = 'NEW'
print(f'Last new record has been imported to DL but is awaiting search indexing ({flag}) ({args.type}# {last_exported["record_id"]} @ {last_exported["time"]})')
else:
raise Exception(f'Last updated record not found by DL search API: {last_dl_record["record_type"]} {last_exported["record_id"]}')

Expand All @@ -198,13 +200,14 @@ def run(**kwargs):
if callback_data['results'][0]['success'] == False:
# the last export was exported succesfully, but failed on import to DL. proceed with export
pass
else:
# the last export has been imported to DL but is awaiting search indexing
print(f'last new record has been imported to DL but is awaiting search indexing ({flag}) ({args.type}# {last_exported["record_id"]} @ {last_exported["time"]})')
elif flag == 'NEW':
# the record has been imported to DL but isn't searchable yet
exit()
else:
# the record was exported and imported to DL succesfully, but DL did not record the update in
# the 005 field. this can happen if there were no changes to be made to the DL record.
warn(f'Possible redundant export not recorded in DL: {flag} {args.type}# {last_exported["record_id"]}')
else:
# the last export has not been imported by DL yet
print(f'last update not cleared in DL yet ({flag}) ({args.type}# {last_exported["record_id"]} @ {last_exported["time"]})')
exit()

# cycle through records in batches
Expand Down
Loading