-
Notifications
You must be signed in to change notification settings - Fork 17
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
Disambiguate whether a revalidator recognized a request when checking for a need to revalidate #87
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.
LGTM except typos and one question.
manager.go
Outdated
// for a given pull request. It should return a VoucherResult + ErrPause to | ||
// for a given pull request. The first value indicates whether the request was | ||
// recognized by this revalidator and should be considered 'handled'. If true, | ||
// the remaining to values are interpreted. If 'false' the request is passed on |
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.
remaining two*
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 typo needs to be fixed below as well.
return err | ||
handled, result, err = revalidator.OnPushDataReceived(chid, size) | ||
if handled { | ||
return errors.New("stop processing") |
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.
Why do we need to return this error ? So that we break the m.revalidators.Each
loop ?
Is there any other significance of this error ?
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.
yea that's what it does -- it stops the loop -- note that it's ignored in the return
Previously, the revalidators were very ambiguous in identifying if they had actually handled a request for a revalidation check or not -- a "nil, nil" or "voucher result, nil" was interpreted as not being handled. This is unfortunate, cause particularly a "voucher result, nil" is an indication the request is handled by this check, and we should stop processing other revalidators that might override the value with "nil, nil". We now add a boolean to disambiguate whether the revalidator "recognized" this request --- if true, processing stops.
f7d85bd
to
a400317
Compare
* Disambiguate whether a revalidator recognized a request when checking for a need to revalidate (#87) * feat(revalidator): add handled bool Previously, the revalidators were very ambiguous in identifying if they had actually handled a request for a revalidation check or not -- a "nil, nil" or "voucher result, nil" was interpreted as not being handled. This is unfortunate, cause particularly a "voucher result, nil" is an indication the request is handled by this check, and we should stop processing other revalidators that might override the value with "nil, nil". We now add a boolean to disambiguate whether the revalidator "recognized" this request --- if true, processing stops. * style(comments): fix types * feat(impl): cleanup errors cleanup errors -- move more error codes to proper types and insure single error dispatched * test(impl): add unit test for incomplete response
Goals
Previously, the revalidators were very ambiguous in identifying if they had actually handled a
request for a revalidation check or not -- a "nil, nil" or "voucher result, nil" was interpreted as
not being handled. This is unfortunate, cause particularly a "voucher result, nil" is an indication
the request is handled by this check, and we should stop processing other revalidators that might
override the value with "nil, nil". While we could technically stop on a "voucher result, nil" -- it seems best to just make explicit whether we did or did not handle the request.
Implementation
Add a boolean to disambiguate whether the revalidator "recognized" a request for
OnPushDateReceived
,OnPullDataSent
, andOnComplete