File tree 2 files changed +12
-16
lines changed
2 files changed +12
-16
lines changed Original file line number Diff line number Diff line change @@ -2453,21 +2453,11 @@ class ApiMethods {
2453
2453
const params = new URLSearchParams (
2454
2454
labels ?. map ( ( label ) => [ "label" , label ] ) ,
2455
2455
) ;
2456
-
2457
- try {
2458
- const res =
2459
- await this . axios . get < TypesGen . WorkspaceAgentListContainersResponse > (
2460
- `/api/v2/workspaceagents/${ agentId } /containers?${ params . toString ( ) } ` ,
2461
- ) ;
2462
- return res . data ;
2463
- } catch ( err ) {
2464
- // If the error is a 403, it means that experimental
2465
- // containers are not enabled on the agent.
2466
- if ( isAxiosError ( err ) && err . response ?. status === 403 ) {
2467
- return { containers : [ ] } ;
2468
- }
2469
- throw err ;
2470
- }
2456
+ const res =
2457
+ await this . axios . get < TypesGen . WorkspaceAgentListContainersResponse > (
2458
+ `/api/v2/workspaceagents/${ agentId } /containers?${ params . toString ( ) } ` ,
2459
+ ) ;
2460
+ return res . data ;
2471
2461
} ;
2472
2462
2473
2463
getInboxNotifications = async ( startingBeforeId ?: string ) => {
Original file line number Diff line number Diff line change @@ -40,6 +40,7 @@ import { PortForwardButton } from "./PortForwardButton";
40
40
import { AgentSSHButton } from "./SSHButton/SSHButton" ;
41
41
import { TerminalLink } from "./TerminalLink/TerminalLink" ;
42
42
import { VSCodeDesktopButton } from "./VSCodeDesktopButton/VSCodeDesktopButton" ;
43
+ import { isAxiosError } from "axios" ;
43
44
44
45
export interface AgentRowProps {
45
46
agent : WorkspaceAgent ;
@@ -160,7 +161,12 @@ export const AgentRow: FC<AgentRowProps> = ({
160
161
select : ( res ) => res . containers . filter ( ( c ) => c . status === "running" ) ,
161
162
// TODO: Implement a websocket connection to get updates on containers
162
163
// without having to poll.
163
- refetchInterval : 10_000 ,
164
+ refetchInterval : ( _ , query ) => {
165
+ const { error } = query . state ;
166
+ return isAxiosError ( error ) && error . response ?. status === 403
167
+ ? false
168
+ : 10_000 ;
169
+ } ,
164
170
} ) ;
165
171
166
172
return (
You can’t perform that action at this time.
0 commit comments