File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -54,9 +54,9 @@ async function keepFetchingMessages() {
5454 const lastMessageTime = state . messages . at ( - 1 ) ?. timestamp ?? null ;
5555 const queryString = lastMessageTime ? `?since=${ lastMessageTime } ` : "" ;
5656 const url = `${ state . backendURL } /messages${ queryString } ` ;
57- const milliseconds = 100 ;
57+ const pollingIntervalMS = 100 ;
5858 try {
59- // fetch may remain pending up to 25 seconds
59+ // the backend is using long-polling, and will hang open for up to 25 seconds waiting for an update event before returning
6060 const rawResponse = await fetch ( url ) ;
6161 const response = await rawResponse . json ( ) ;
6262 if ( response . length > 0 ) {
@@ -66,7 +66,7 @@ async function keepFetchingMessages() {
6666 } catch ( error ) {
6767 console . log ( `Failed on connection: ${ error } ` ) ;
6868 }
69- setTimeout ( keepFetchingMessages , milliseconds ) ;
69+ setTimeout ( keepFetchingMessages , pollingIntervalMS ) ;
7070}
7171
7272function messageInputReset ( ) {
You can’t perform that action at this time.
0 commit comments