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

Fix failure to set unlimited_access property on non-existent pool. #1402

Merged
merged 1 commit into from
Sep 22, 2023

Conversation

dbernstein
Copy link
Contributor

@dbernstein dbernstein commented Sep 22, 2023

Description

Simply checks if the pool is not None before trying to set a property on it.
Improves logging to show detailed failure info in logs during OPDS feed imports so that future issues will be easier to troubleshoot in the future.

One thing I'm not sure about: does it make sense for the pool to be returned as a None from super().update_work_for_e dition

Motivation and Context

https://ebce-lyrasis.atlassian.net/browse/PP-192

How Has This Been Tested?

I reran San Rafael BiblioBoard collection locally and confirmed that all 139 failures are no longer occurring.

./bin/opds_for_distributors_import_monitor --collection "San Rafael BiblioBoard" --force
...
99d7-25f0535356c6: rel=alternate", "timestamp": "2023-09-22T17:57:25.570186+00:00"}
{"host": "8e97e3d1a6b0", "app": "simplified", "name": "OPDS for Distributors Import Monitor", "level": "INFO", "filename": "monitor.py", "message": "[San Rafael BiblioBoard] Items imported: 30379. Failures: 0.", "timestamp": "2023-09-22T17:57:25.652138+00:00"}
{"host": "8e97e3d1a6b0", "app": "simplified", "name": "OPDS for Distributors Import Monitor", "level": "INFO", "filename": "monitor.py", "message": "[San Rafael BiblioBoard] Ran OPDS for Distributors Import Monitor monitor in 3664.29 sec.", "timestamp": "2023-09-22T17:57:25.657573+00:00"}

Checklist

  • [/] I have updated the documentation accordingly.
  • [] All new and existing tests passed.

Improve logging to show detailed failure info in logs during OPDS feed imports.

Resolves: https://ebce-lyrasis.atlassian.net/browse/PP-192
@codecov
Copy link

codecov bot commented Sep 22, 2023

Codecov Report

Patch coverage: 100.00% and no project coverage change.

Comparison is base (ac78b47) 90.17% compared to head (540b347) 90.17%.

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #1402   +/-   ##
=======================================
  Coverage   90.17%   90.17%           
=======================================
  Files         226      226           
  Lines       29871    29872    +1     
  Branches     6845     6845           
=======================================
+ Hits        26936    26938    +2     
+ Misses       1893     1892    -1     
  Partials     1042     1042           
Files Changed Coverage Δ
core/opds_import.py 89.18% <100.00%> (+0.01%) ⬆️

... and 1 file with indirect coverage changes

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@@ -357,7 +357,10 @@ def update_work_for_edition(self, *args, **kwargs):
pool, work = super().update_work_for_edition(
*args, is_open_access=False, **kwargs
)
pool.unlimited_access = True

if pool:
Copy link
Contributor Author

Choose a reason for hiding this comment

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

One thing I'm not sure about: does it make sense for the pool to be returned as a None from super().update_work_for_edition. The update_work_for_edition seems to allow for it and downstream code seems to expect it, but I'm wondering if makes sense in this context.

Copy link
Member

Choose a reason for hiding this comment

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

It does seem like the super class expects to return None in some cases. So I think this is an okay fix.

Copy link
Member

@jonathangreen jonathangreen left a comment

Choose a reason for hiding this comment

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

Looks good to me.

@dbernstein dbernstein merged commit 35e32de into main Sep 22, 2023
30 checks passed
@dbernstein dbernstein deleted the bugfix/PP-192-San-Rafael-Failures branch September 22, 2023 19:48
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