Codespaces Delete API and List API not in sync #34576
-
|
I was working on an integration with Codespaces API. I have noticed that when I delete a codespace using the delete API and then call the List Codespaces in Repo for Auth user API, the list still contains the deleted codespace. It takes around 20-25 seconds for the codespaces to be removed from the List API. Not a big issue but annoying when trying to integrate using the API. Edit: Seems to be due to HTTP Caching on browser - I assume that the list API response is sending some wrong cache signals to the client. |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment
-
|
If anyone else stumbles into this issue I worked around it by passing a random string query parameter to invalidate browser cache await octokit.rest.codespaces.listInRepositoryForAuthenticatedUser({
owner: this.state.codespacesConfig.ghBridgeRepoOwner,
repo: this.state.codespacesConfig.ghBridgeRepoName,
// Sending a random param to invalidate browser cache as GH seems to be sending
// wrong cache signals in this API
test: Math.random().toString(36).slice(2, 12),
}); |
Beta Was this translation helpful? Give feedback.
If anyone else stumbles into this issue I worked around it by passing a random string query parameter to invalidate browser cache
https://github.com/ronakj/ado-gh-codespaces-extension/blob/e1c79983b9cc69e64f9037d3e534f72db0a01204/src/ExtensionComponents/CodespacesHub/CodespacesHub.tsx#L391C7-L397C10