confluentinc / confluentinc/vscode
Revise CCloudAuthStatusMiddleware to observe CCloud auth token status changes
- Dominant language
- TypeScript
- Stars
- 34
- Forks
- 17
- Avg merge
- 1d 22h
- Merged PRs (30d)
- 8
Description
As of time of writing, `CCloudAuthStatusMiddleware` does a secrets store fetch on every CCloud-related sidecar route hit in order to decide if should delay the request until we know that the access token is in a good state. That's relatively expensive, involving round-trips to the main VSCode process, secret store decryption, etc.
Instead, rearchitect the middleware to locally cache the token status (deep fetch first time needed), but have a `SecretStore.onDidChange()` event listener monitoring for any changes to this secret, and then re-fetch only when truly needed.
Or consider having `ccloudStateHandling.ts`'s ccloud connection websocket event monitoring either directly or indirectly (via event listener) message `CCloudAuthStatusMiddleware` when ccloud token state changes happen. Currently, this is done _very_ indirectly, in that `ccloudStateHandling.ts` is the source of updating the connection state kept in the secret store.
Far fewer trips to the secret store!
Contributor guide
Assessment
This issue has not been assessed yet.