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
703 Added RECAP Fetch webhook event #2453
Conversation
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.
A couple small tweaks, please. I also pushed some updates to the docs that you'll see.
3a1e80d
to
1c53e9c
Compare
Thank you! I've applied the requested changes. The one related to moving |
Just merged the refactor into this one. Let me know when you feel good about this one if you don't already. |
543cbbc
to
f2e0ba1
Compare
f2e0ba1
to
e654bc9
Compare
Thanks for your comments, I have applied the suggestion and this seems ready! |
This PR adds support for RECAP Fetch webhook events as commented in #703.
The webhook event has the following structure:
Is triggered when the fetch task is marked as completed when one of the following statuses:
SUCCESSFUL
,FAILED
,INVALID_CONTENT
, orNEEDS_INFO
Webhook events are not triggered on the following statuses:
ENQUEUED
,IN_PROGRESS
, orQUEUED_FOR_RETRY
Working on this I detected some bugs and changes that were needed:
mark_fq_status
(SUCCESSFUL) at the end offetch_docket
to avoid duplicated webhook events since there is amark_fq_successful
task withindo_pacer_fetch
for fetch docketchain
.fetch_docket
task, when cookies expired thefq
object was marked as failed but the task execution and following tasks in the chain continue. When the task and consecutive tasks in the chain should be aborted, I solved it by returning None if there are no cookies. The reason tests were not catching this problem is that within a test all the tasks in a chain are executed so themark_fq_successful
task was being executed even though the fetch failed.RecapDocketFetchApiTest
adding a mock for cookies and adding an additional assert that checks if aRECAPDocument
is created when fetching the docket instead of only relying on the FQ SUCCESSFUL status.pacer_case_id
andcourt
it was not working since thepacer_case_id
provided in the requests was not being used, so I added it in the first place here: tasks.py#L1695, so that if thepacer_case_id
is passed in the fetch request it'll be used. The test for thistest_fetch_docket_by_pacer_case_id
was not failing for the same reason described above related tomark_fq_successful
task. So I also added an additional assert to confirm the docket is properly fetched.Let me know what you think.