Skip to content

USE 558 - Perform DSpace GET requests with automati reauthentication#13

Merged
ghukill merged 2 commits into
mainfrom
USE-558-long-running-jobs
May 20, 2026
Merged

USE 558 - Perform DSpace GET requests with automati reauthentication#13
ghukill merged 2 commits into
mainfrom
USE-558-long-running-jobs

Conversation

@ghukill

@ghukill ghukill commented May 20, 2026

Copy link
Copy Markdown
Collaborator

Purpose and background context

Why these changes are being introduced:

Some testing of large harvests revealed cascading errors later in the run. Traced this back to DSpace API connections that got stale.

How this addresses that need:

Other routes in the dspace-rest-python client automatically refresh the connection, but GET routes currently do not. A smaller helper is added that performs GET requests, re-authenticating once if a 401 error is encountered.

How can a reviewer manually see the effects of these changes?

Not easy to recreate the error, but local testing has confirmed it's hugely impactful.

The first attempt at a long running job resulted in ~47k fulltexts extracted @ 2.5 hours. With the re-authentication in place, seeing ~64k fulltexts extracted @ 50 minutes.

More successes and faster? As the connections got stale in the first run, they never recovered, but there were long retries + backoffs. So worst case happened: it took a long time to ultimately fail for last ~17k records. With the updates, we're seeing near 100% success, ignoring the DSpace items that actually don't have a TEXT bitstream for the moment.

Includes new or updated dependencies?

NO

Changes expectations for external applications?

YES: Long running jobs are possible, stale connections not seen

What are the relevant tickets?

Code review

  • Code review best practices are documented here and you are encouraged to have a constructive dialogue with your reviewers about their preferences and expectations.

Why these changes are being introduced:

Some testing of large harvests revealed cascading errors later in the run.  Traced
this back to DSpace API connections that got stale.

How this addresses that need:

Other routes in the dspace-rest-python client automatically refresh the
connection, but GET routes currently do not.  A smaller helper is added that
performs GET requests, re-authenticating once if a 401 error is encountered.

Side effects of this change:
* Long running jobs are possible, stale connections not seen

Relevant ticket(s):
* https://mitlibraries.atlassian.net/browse/USE-558
@ghukill ghukill marked this pull request as ready for review May 20, 2026 17:09
@ghukill ghukill requested a review from a team as a code owner May 20, 2026 17:09

@ehanson8 ehanson8 left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Smart fix!

Comment thread dfh/dspace.py
@ghukill ghukill merged commit 7d09f87 into main May 20, 2026
5 of 6 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants