]> git.mjollnir.org Git - moodle.git/commitdiff
mod/chat - Normal method - users pane only uses keepalive when refreshing fast
authormartinlanghoff <martinlanghoff>
Mon, 17 Apr 2006 21:05:17 +0000 (21:05 +0000)
committermartinlanghoff <martinlanghoff>
Mon, 17 Apr 2006 21:05:17 +0000 (21:05 +0000)
To avoid wasting server resources, user's pane now only uses keepalive
when the refresh is lower than apache's timeout.

mod/chat/gui_header_js/users.php

index 159fcde791e2d4a92f007debc5086219489be52a..73807129244af4f50baefb773a75cabaa9d0b0ae 100644 (file)
     }
     echo '</table></body></html>';
 
-    // support HTTP Keep-Alive
-    header("Content-Length: " . ob_get_length() );
-    ob_end_flush();
+    //
+    // Support HTTP Keep-Alive by printing Content-Length
+    //
+    // If the user pane is refreshing often, using keepalives 
+    // is lighter on the server and faster for most clients. 
+    //
+    // Apache is normally configured to have a 15s timeout on 
+    // keepalives, so let's observe that. Unfortunately, we cannot
+    // autodetect the keepalive timeout. 
+    //
+    // Using keepalives when the refresh is longer than the timeout
+    // wastes server resources keeping an apache child around on a  
+    // connection that will timeout. So we don't. 
+    if ($CFG->chat_refresh_userlist < 15) {    
+        header("Content-Length: " . ob_get_length() );
+        ob_end_flush(); 
+    }
+
     exit; // no further output