-
-
Notifications
You must be signed in to change notification settings - Fork 11
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
[BACK-2866] Fix Dexcom task failing for newly created Dexcom connections #697
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,6 @@ | ||
*.coverprofile | ||
_bin/ | ||
_tmp/ | ||
coverprofile.out | ||
debug | ||
deploy/ |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,5 @@ | ||
*.coverprofile | ||
*.env | ||
*.test | ||
/_bin | ||
/_data | ||
|
@@ -7,3 +8,5 @@ | |
/deploy | ||
/.idea | ||
.DS_Store | ||
.envrc | ||
coverprofile.out |
Original file line number | Diff line number | Diff line change | ||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
@@ -69,7 +69,9 @@ func UsersDataSetsCreate(dataServiceContext dataService.Context) { | |||||||||||||
} | ||||||||||||||
|
||||||||||||||
dataSet.SetUserID(&targetUserID) | ||||||||||||||
dataSet.SetCreatedUserID(pointer.FromString(details.UserID())) | ||||||||||||||
if details.IsUser() { | ||||||||||||||
dataSet.SetCreatedUserID(pointer.FromString(details.UserID())) | ||||||||||||||
} | ||||||||||||||
Comment on lines
+72
to
+74
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Would it be simpler, given the validation failure, to do:
Suggested change
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Per discussions in Slack, will leave as-is. Using the system-generated user ID for service session tokens will cause downstream issues. Plus, existing platform code that references the |
||||||||||||||
|
||||||||||||||
dataSet.Normalize(normalizer) | ||||||||||||||
|
||||||||||||||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -35,9 +35,9 @@ func NewTaskCreate(providerSessionID string, dataSourceID string) (*task.TaskCre | |
} | ||
|
||
func ErrorOrRetryTask(t *task.Task, err error) { | ||
t.AppendError(err) | ||
if t.IsFailed() { | ||
if shouldTaskError(t) { | ||
t.AppendError(err) | ||
if shouldTaskFail(t) { | ||
return | ||
} | ||
incrementTaskRetryCount(t) | ||
|
@@ -51,7 +51,7 @@ func FailTask(l log.Logger, t *task.Task, err error) error { | |
return err | ||
} | ||
|
||
func shouldTaskError(t *task.Task) bool { | ||
func shouldTaskFail(t *task.Task) bool { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I don't think this function handles correctly the case where the There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yes, that is correct and I intentionally did not fix that yet. If we make that fix right now, then every Dexcom task that hits a 429 will start down the "retry path" and, after retrying 3 times, will be marked as failed. I really don't want that to happen quite yet. I need to first straighten out what errors cause a formal retry (where the retry counter is incremented; e.g. Dexcom auth errors), what errors retry for "free" (no increment; e.g. Dexcom 429s), and what errors fail immediately (e.g bad data). Furthermore, I need to add code that resets the retry counter on success (as there is no code to do that currently). |
||
if t.Data[dexcomTaskRetryField] != nil { | ||
count, ok := t.Data[dexcomTaskRetryField].(int) | ||
if ok { | ||
|
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.
FYI,
details.UserID
will be set to the id of the backend client service account, which is a real user in Keycloak.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.
Hmm, that's not what I'm seeing. I'm getting an empty string which causes a failure during later validation (
CreatedUserID
ofnil
is fine, but an empty string is not).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'll double check.
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.
While the service session token does include the
UserID
of the backend client service account, it is not being used because the session token is marked asIsServer
. Find the relevant code that ignores theUserID
for a server session token atplatform/auth/client/external.go
Line 208 in f797630