-
Notifications
You must be signed in to change notification settings - Fork 145
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
Refreshing cache doesn't work #379
Comments
Based on my investigation,
I am getting a fresh call with correct applist
|
@yc185050 I think the example in the readme is incorrect on the suggestion of using a request executor clone each time. Instead just use the current request executor. Does this code solve your problem? func main() {
ctx, client, err := getOktaClient()
if err != nil {
return
}
// create an app
basicApplication := okta.NewBasicAuthApplication()
basicApplication.Settings = &okta.BasicApplicationSettings{
App: &okta.BasicApplicationSettingsApplication{
AuthURL: "https://example.com/auth.html",
Url: "https://example.com/auth.html",
},
}
myapp, _, err := client.Application.CreateApplication(ctx, basicApplication, nil)
if err != nil {
return
}
appId := myapp.(*okta.BasicAuthApplication).Id
// list app
appList, _, _ := client.Application.ListApplications(ctx, nil)
fmt.Printf("applist length before delete: %d\n", len(appList))
// deactivate and delete
_, err = client.Application.DeactivateApplication(ctx, appId)
if err != nil {
return
}
_, err = client.Application.DeleteApplication(ctx, appId)
if err != nil {
return
}
// refresh cache
client.GetRequestExecutor().RefreshNext()
// list app again
appList, _, _ = client.Application.ListApplications(ctx, nil)
fmt.Printf("applist length after delete: %d\n", len(appList))
} |
@yc185050 if you confirm this works for you I'll correct the example in the readme. |
No. It will get correct value but that's because
will set current Actually workaround example I provided above is exactly how it is supposed to be used. However, the implementation of |
Getting this on to our backlog: |
This issue has been marked stale because there has been no activity within the last 14 days. To keep this issue active, remove the |
This issue has been marked stale because there has been no activity within the last 14 days. To keep this issue active, remove the |
Using okta-sdk-golang/okta/requestExecutor.go Lines 453 to 457 in 758b8c3
So I'm not sure this is correct:
The significant downside, however, is that there's a race. If another request uses the underlying executor before the call you're intending to cache-bust, then you'll end up with a cached response despite best efforts. I believe this is the reason the documentation references |
This issue has been marked stale because there has been no activity within the last 14 days. To keep this issue active, remove the |
This issue has been marked stale because there has been no activity within the last 14 days. To keep this issue active, remove the |
Describe the bug?
According to https://github.com/okta/okta-sdk-golang#refreshing-cache-for-specific-call,
client.CloneRequestExecutor().RefreshNext()
can be used to force refreshing the cache on next call.However, based on testing, it doesn't work.
See code snippet below
What is expected to happen?
expected output:
What is the actual behavior?
actual output
Reproduction Steps?
see above
Additional Information?
No response
Golang Version
go version go1.18.8 darwin/amd64
SDK Version
github.com/okta/okta-sdk-golang/v2 v2.18.0
OS version
No response
The text was updated successfully, but these errors were encountered: