File tree Expand file tree Collapse file tree 1 file changed +4
-3
lines changed
Expand file tree Collapse file tree 1 file changed +4
-3
lines changed Original file line number Diff line number Diff line change @@ -97,9 +97,9 @@ export class ServerConnection {
9797 }
9898 }
9999
100- getServerStatus = async ( ) : Promise < ServerStatus > => {
100+ getServerStatus = async ( timeout : number = 10000 ) : Promise < ServerStatus > => {
101101 await this . lastServerStatusPromise
102- this . lastServerStatusPromise = this . fetchServerStatus ( ) ;
102+ this . lastServerStatusPromise = this . fetchServerStatus ( timeout ) ;
103103
104104 const status = await this . lastServerStatusPromise ;
105105
@@ -114,12 +114,13 @@ export class ServerConnection {
114114 setTimeout ( this . updateStatusLoop , 5000 ) ;
115115 }
116116
117- private fetchServerStatus = async ( ) : Promise < ServerStatus > => {
117+ private fetchServerStatus = async ( timeout : number ) : Promise < ServerStatus > => {
118118 try {
119119 const res = await this . fetch ( url . status , {
120120 headers : {
121121 'Content-Type' : 'application/json'
122122 } ,
123+ signal : AbortSignal . timeout ( timeout )
123124 } ) ;
124125
125126 if ( res . status !== 200 ) {
You can’t perform that action at this time.
0 commit comments