-
Notifications
You must be signed in to change notification settings - Fork 25
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
fix(documents): delete orphan harvested documents #3777
Conversation
PascalRepond
commented
Nov 12, 2024
- Closes Periodically delete orphan harvested documents #3776.
5e30c19
to
03927a1
Compare
rero_ils/modules/documents/tasks.py
Outdated
if delete: | ||
try: | ||
if doc.reasons_not_to_delete() == {"others": {"harvested": True}}: | ||
doc.delete(dbcommit=True, delindex=True, force=True) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not sure force=True
will do the trick. Force will delete the persistent identifier in DB. I think yo have to set harvested
to False
before deleting.
30f3035
to
dab526b
Compare
dab526b
to
6532ff5
Compare
* Closes rero#3776. Co-Authored-by: Pascal Repond <pascal.repond@rero.ch>
6532ff5
to
86b09b1
Compare
for pid in pids: | ||
if doc := Document.get_record_by_pid(pid): | ||
if verbose: | ||
click.secho(f"Deleting orphan harvested: {pid}", fg="yellow") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is available only using python click.
except Exception: | ||
msg = f"COULD NOT DELETE ORPHAN HARVESTED: {pid} {doc.reasons_not_to_delete()}" | ||
if verbose: | ||
click.secho(f"ERROR: {msg}", fg="red") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
same