Avoid duplicating ActiveJob's retry machinery#11061
Conversation
Sgtpluck
left a comment
There was a problem hiding this comment.
i don't know enough about ActiveJob to say whether this code would be successful, but it does seem like a reasonable approach. i have some suggestions/questions about the tests, though
spec/jobs/risc_delivery_job_spec.rb
Outdated
There was a problem hiding this comment.
i don't personally really like shared_examples, but since you've set them up, why wouldn't you use them for the different types of errors?
There was a problem hiding this comment.
My preference has been to use shared_examples for larger examples.
There was a problem hiding this comment.
since they are designed for reuse, it is confusing to me that you would add them and then not use them for all the similar specs -- it makes me think these are different in some way. am i missing something about them that makes them different?
i would prefer to either write out the longer specs explicitly (my actual preference, since i find shared examples hard to read, especially when there are failures), or use them for all examples because of that confusion it creates. does that make sense?
There was a problem hiding this comment.
I see what you mean. The mocking fixture was different, the call count expectation was different and the risc event payload error message was different. I'll get rid of the shared_examples as they seem to add to the confusion in this case.
spec/jobs/risc_delivery_job_spec.rb
Outdated
There was a problem hiding this comment.
is there a way to use webmock to return the right error instead of manually stubbing Faraday?
There was a problem hiding this comment.
IIANM, the comments on lines 114-115 were from you and seemed to indicate that it would not simulate the real world behavior. Should I investigate further?
There was a problem hiding this comment.
LOL I had completely forgotten, you can investigate more if you want, but it's probably fine as is
changelog: Internal, Error Handling, Avoid duplicating ActiveJob's retry machinery It may address https://gitlab.login.gov/lg-people/lg-people-appdev/Melba/backlog-fy24/-/issues/37. This is an attempt to use ActiveJob's retry machinery properly, so that errors do not bubble up to NewRelic.
0efd653 to
a2b10bd
Compare
changelog: Internal, Error Handling, Avoid duplicating ActiveJob's retry machinery
It may address
https://gitlab.login.gov/lg-people/lg-people-appdev/Melba/backlog-fy24/-/issues/37.
This is an attempt to use ActiveJob's retry machinery properly, so that errors do not bubble up to NewRelic.