-
Notifications
You must be signed in to change notification settings - Fork 74
Fixes:[T348412] Handle PDL library failures #198
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
Fixes:[T348412] Handle PDL library failures #198
Conversation
bull/pdl-queue/consumer.js
Outdated
| downloadImageStatus = await download_image(str, `${title}_${i}.jpeg`); | ||
| job.progress(Math.round((i / temp_pages) * 82)); | ||
| } | ||
| let isError = downloadImageStatus === 500 ? true : false; |
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.
What if the error is not 500 but 503 or 404 or something else? We should handle all the possible failures. I suggest check for 2xx, else return failure.
|
@coderwassananmol I have made the requested changes |
| done(null, true); | ||
|
|
||
| if (isError) { | ||
| logger.log({ |
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.
Please log in the job logs as well including username.
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.
@coderwassananmol
I have made the requested changes
b3cf764 to
745e8b5
Compare
coderwassananmol
left a comment
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.
@okerekechinweotito Currently, we are traversing through each image in a for loop and even though the first x pages could return 500 and even if the last page is successful, we will return it as success but in reality the book will be uploaded incomplete.
The expectation is that even if a single page fails to load, we will NOT upload the book to Internet Archive. The error must be logged and the upload must entirely fail. The failed reason should say: "Upload to Internet Archive failed because {link to the first inaccessible page} is not reachable. Please try again or contact Panjab Digital Library for more details."
745e8b5 to
6503ddc
Compare
|
@coderwassananmol I have pushed a possible fix for that |
bull/pdl-queue/consumer.js
Outdated
| job.progress(100); | ||
| done( | ||
| new Error( | ||
| `Upload to Internet Archive failed because ${errorFlag.page} is not reachable. Please try again or contact Panjab Digital Library for more details.` |
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.
Can you please add a href to this with target="_blank" so that it opens up in a new tab when user clicks on it?
coderwassananmol
left a comment
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.
Just add href to the link. Rest seems to be working.
|
@coderwassananmol I have pushed a possible fix for that |
coderwassananmol
left a comment
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.
LGTM


Fixes: T348412
Proposed Changes
Files Created/Updated
Current Look
Checklist