Skip to content
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

fix(notifications): extension activation hangs if fetch fails #6052

Merged
merged 2 commits into from
Nov 20, 2024

Conversation

hayemaxi
Copy link
Contributor

Problem

If notifications fail to fetch, it will retry multiple times with 30 second waits. Activation is awaiting on this though, so it may take forever to finish.

Solution

don't await on notification activation

Also, update logging statements.


License: I confirm that my contribution is made under the terms of the Apache 2.0 license.

@hayemaxi hayemaxi requested a review from a team as a code owner November 19, 2024 22:47

This comment was marked as resolved.

@hayemaxi hayemaxi force-pushed the notifications6 branch 3 times, most recently from 3e4a5d6 to 903c23c Compare November 19, 2024 22:54
Problem: If notifications fail to fetch, it will retry multiple times with 30 second waits. Activation is awaiting on this though, so it may take forever to finish.
Solution: don't await on notification activation

Also, update logging statements.
- Simplify when to focus the notifications panel for emergency notifications.
- Try to limit race conditions when dismissing notifications.
@hayemaxi hayemaxi merged commit f355557 into aws:master Nov 20, 2024
24 of 25 checks passed
getLogger('notifications').debug('Activated in-IDE notifications polling module')
logger.debug('Activated in-IDE notifications polling module')
} catch (err) {
logger.error('Failed to activate in-IDE notifications module.')
Copy link
Contributor

Choose a reason for hiding this comment

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

.... %O', err)`

or err.message

@@ -75,7 +75,7 @@ async function activateAmazonQNode(context: vscode.ExtensionContext) {
...authState,
})

await activateNotifications(context, authState, getAuthState)
void activateNotifications(context, authState, getAuthState)
Copy link
Contributor

Choose a reason for hiding this comment

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

if possible it's helpful to make activateNotications non-async, so that it clearly signals that it does its own logging and .catch() of async functions itself.

Comment on lines +279 to +285
return withRetries(
async () => {
try {
return await fetcher.getNewETagContent(versionTag)
} catch (err) {
logger.error('Failed to fetch at endpoint: %s, err: %s', endpoint, err)
throw err
Copy link
Contributor

Choose a reason for hiding this comment

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

withRetries should do useful logging of failure by default. We have so much nesting of these wrapper functions, we might as well do something with it...

@hayemaxi
Copy link
Contributor Author

Will follow up with your comments @justinmk3

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants