Skip to content

fix: Ignore older config lastmodified timestamps when fetching a config. #263

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

Merged
merged 8 commits into from
Jul 12, 2024

Conversation

JamieSinn
Copy link
Member

Also set clientdate on sdkconfig events, and regular tracked events.

…e to set an older config.

Also set clientdate on events.
@JamieSinn JamieSinn requested a review from suthar26 July 12, 2024 17:58
Comment on lines +222 to 224
if len(minimumLastModified) > 0 && storedLM.Before(minimumLastModified[0]) {
lastModified = minimumLastModified[0].Format(time.RFC1123)
}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you explain what this is trying to do? where is minimumLastModified coming from?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Check if MinimumLastModified is passed (length check) - if it exists; then check whether or not the stored last modified timestamp is before the passed new minimum. If it is - set that as the new header to set.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

minlastmodified is used by SSE to pass a minimum request timestamp that we should expect.

configmanager.go Outdated
if parseError == nil {
if len(minimumLastModified) > 0 && lastModifiedHeaderTS.Before(minimumLastModified[0]) && numRetriesRemaining > 0 {
if storedLM.After(responseLastModified) {
return e.fetchConfig(numRetriesRemaining - 1)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

should we add a warning here?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we could - but nothing really will be done from it - it's an inactionable warning

configmanager.go Outdated
if storedLM.After(responseLastModified) {
return e.fetchConfig(numRetriesRemaining - 1)
}
if len(minimumLastModified) > 0 && responseLastModified.Before(minimumLastModified[0]) && numRetriesRemaining > 0 {
return e.fetchConfig(numRetriesRemaining-1, minimumLastModified...)
}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

doesn't there need to be an else statement here that if its beyond the number of retries that it doesn't try and save the old request body?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

also need a test for this ^

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'll add an abort out otherways - but that's not where we would want to abort.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We do - it's the test I added

@JamieSinn JamieSinn enabled auto-merge (squash) July 12, 2024 20:37
@JamieSinn JamieSinn merged commit 027e972 into main Jul 12, 2024
8 checks passed
@JamieSinn JamieSinn deleted the jamie/last-modified branch July 12, 2024 20:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

3 participants