-
Notifications
You must be signed in to change notification settings - Fork 9
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
Datapusher fixes #356
base: master
Are you sure you want to change the base?
Datapusher fixes #356
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.
Do we need to continue to support the legacy UserAccount
authentication? Seems to me like what we should do is fully switch over to APIQuery
and then maybe adjust authorization rules to disallow DataPusher
requests from regular users.
The intention, as I understand it, was to not disrupt legacy behavior or create a breaking change. |
Can we go ahead and create a breaking change then? IMO, we can fix the errors at GTC/GPC easily enough, but we have no process for removing the legacy behavior later. |
dc172e7
to
eb201b5
Compare
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.
Really excellent cleanups in this PR. I like where this is headed. I just noticed a couple problematic patterns that were repeated several times. They should be easy enough to clear up.
if (!response.IsSuccessStatusCode) | ||
throw new InvalidOperationException($"Server returned status code {response.StatusCode}: {response.ReasonPhrase}"); |
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.
I know this pattern wasn't introduced this PR, but now seems like a good time to switch to response.EnsureSuccessStatusCode()
.
if (!response.IsSuccessStatusCode) | |
throw new InvalidOperationException($"Server returned status code {response.StatusCode}: {response.ReasonPhrase}"); | |
response.EnsureSuccessStatusCode(); |
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.
I did so, out of curiosity and ignorance, why is this a bad pattern?
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.
response.EnsureSuccessStatusCode()
will throw an HttpResponseException
, I believe. Exception handlers will be more likely to expect it. For example, and if I'm not mistaken, the HTTP status code would be passed through to the client automatically by ApiController
handlers.
It also reduces nesting, which typically makes the code more readable.
71b3060
to
1cd1391
Compare
…ore connections) may be pushed at once SC-162
… may all be dealt with simultanously
1cd1391
to
8cbf8de
Compare
Required By
GridProtectionAlliance/SystemCenter#506
✅ GridProtectionAlliance/gpa-gemstone#317
SC-161
SC-162
SC-163
SC-199