Skip to content

Conversation

@Slessi
Copy link
Member

@Slessi Slessi commented Nov 26, 2025

Instead of throwing an error when we try to make requests before signing keys are ready, we enter a loop to wait for keys to exist. This prevents errors and the need to handle them, as well as making requests fire immediately when keys are eventually ready.

Instead of throwing an error when we try to make requests before signing keys are ready, we enter a loop to wait for keys to exist. This prevents errors and the need to handle them, as well as making requests fire immediately when keys are eventually ready.

Signed-off-by: Edward Sammut Alessi <[email protected]>
@github-project-automation github-project-automation bot moved this to To Do in Planning Nov 26, 2025
@talos-bot talos-bot moved this from To Do to In Review in Planning Nov 26, 2025
</a>

<OngoingTasks v-if="authorized" />
<OngoingTasks />
Copy link
Member Author

Choose a reason for hiding this comment

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

Minor side effect, now when waiting to create keys, you will see the ongoing tasks menu item, where as before you didn't. I think this was originally only being handled to not throw console errors, so unless we specifically do not want to show it at this moment, this is one less case to handle.

Image

// Enter a loop to wait for keys to be ready.
// Request will fire when we have keys.
return await new Promise<string>((resolve) => {
setTimeout(() => {
Copy link
Member

Choose a reason for hiding this comment

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

this might be a dumb question, but why can't we make a function not fire an exception on no keys, and just wait on its own?

or have two versions, one which waits and another one which throws an error?

Copy link
Member

Choose a reason for hiding this comment

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

I'm trying to avoid the setTimeout loop 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.

The setTimeout here is my version of waiting, it will essentially poll for keys every 100ms.

There are other ways to do it, could be with events & listeners for example, but I just went with the most straight forward option in front of me.

WDYT?

Copy link
Member

Choose a reason for hiding this comment

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

I don't want to block the PR, I was just more curious if the Promise should not fail with "no keys" but itself wait for the keys to be establishes, avoiding the need to for polling.

Copy link
Member

Choose a reason for hiding this comment

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

yeah, I'd also prefer some event handler instead

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

Status: In Review

Development

Successfully merging this pull request may close these issues.

4 participants