-
Notifications
You must be signed in to change notification settings - Fork 275
use RemoteResourceResolver in notification polling for etag and PATH handling #5165
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
Conversation
Qodana Community for JVMIt seems all right 👌 No new problems were found according to the checks applied 💡 Qodana analysis was run in the pull request mode: only the changed files were checked Contact Qodana teamContact us at [email protected]
|
...unity/src/software/aws/toolkits/jetbrains/core/notifications/NotificationResourceResolver.kt
Fixed
Show fixed
Hide fixed
...unity/src/software/aws/toolkits/jetbrains/core/notifications/NotificationResourceResolver.kt
Fixed
Show fixed
Hide fixed
...unity/src/software/aws/toolkits/jetbrains/core/notifications/NotificationResourceResolver.kt
Fixed
Show fixed
Hide fixed
...unity/src/software/aws/toolkits/jetbrains/core/notifications/NotificationResourceResolver.kt
Fixed
Show fixed
Hide fixed
...unity/src/software/aws/toolkits/jetbrains/core/notifications/NotificationResourceResolver.kt
Fixed
Show fixed
Hide fixed
...unity/src/software/aws/toolkits/jetbrains/core/notifications/NotificationResourceResolver.kt
Fixed
Show fixed
Hide fixed
...unity/src/software/aws/toolkits/jetbrains/core/notifications/NotificationResourceResolver.kt
Fixed
Show fixed
Hide fixed
...unity/src/software/aws/toolkits/jetbrains/core/notifications/NotificationResourceResolver.kt
Fixed
Show fixed
Hide fixed
|
|
||
| private fun getEndpointETag(): String = | ||
| try { | ||
| HttpRequests.request(NotificationEndpoint.getEndpoint()) |
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.
use a HEAD request if all you are interested in is the headers of GET
| data object FirstPollCheck : UpdateCheckResult() | ||
| } | ||
|
|
||
| class NotificationResourceResolver( |
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.
lets fold this into DefaultRemoteResourceResolver because there is nothing special about etag handling
| private fun getEndpointETag(endpoint: String): String = | ||
| try { | ||
| val url = URI(endpoint).toURL() | ||
| (url.openConnection() as HttpURLConnection).let { connection -> |
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.
java 11 has a newer way of doing this, but let's actually use the HttpRequests util you were using in a previous PR
| complete(file) | ||
| } | ||
|
|
||
| // following two methods are not used in this test, make compiler happy |
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.
you can simply just define a default implementation in the interface if this is the generic no-op implementation
|
|
||
| override fun checkForUpdates(endpoint: String, eTagProvider: ETagProvider): UpdateCheckResult { | ||
| val hasETagUpdate = updateETags(eTagProvider, endpoint) | ||
| // for when we need to notify on first poll even when there's no new ETag |
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.
it would make more sense to see if ETagProvider has a value set to determine if this were the first request
…handling (aws#5165) * always fetch from endpoint during poll * notification resource resolver * ResourceResolver etag handling * codescan * remove redundant modifier * move functionality to DefaultRemoteResourceResolver * implement defaultRemoteResourceResolverProvider instead * url deprecated * detekt * detektTest fix mock functions * detekt * default function in interface * re-implement HTTPRequest * re-implement HTTPRequest * ETag fix * LazyLogRule
…handling (aws#5165) * always fetch from endpoint during poll * notification resource resolver * ResourceResolver etag handling * codescan * remove redundant modifier * move functionality to DefaultRemoteResourceResolver * implement defaultRemoteResourceResolverProvider instead * url deprecated * detekt * detektTest fix mock functions * detekt * default function in interface * re-implement HTTPRequest * re-implement HTTPRequest * ETag fix * LazyLogRule
…handling (aws#5165) * always fetch from endpoint during poll * notification resource resolver * ResourceResolver etag handling * codescan * remove redundant modifier * move functionality to DefaultRemoteResourceResolver * implement defaultRemoteResourceResolverProvider instead * url deprecated * detekt * detektTest fix mock functions * detekt * default function in interface * re-implement HTTPRequest * re-implement HTTPRequest * ETag fix * LazyLogRule
Implement custom RemoteResourceResolver for notification logic to handle ETag fetching and providing the path to the local resource.
Types of changes
Description
Checklist
License
I confirm that my contribution is made under the terms of the Apache 2.0 license.