From ce6317c5205cc8d4cb2d040473965f2dba61f79a Mon Sep 17 00:00:00 2001 From: Martin Edenhofer Date: Tue, 7 Aug 2012 23:53:43 +0200 Subject: [PATCH] Small performance improvements. --- lib/web_socket.rb | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/lib/web_socket.rb b/lib/web_socket.rb index 35396cc6f..f56089477 100644 --- a/lib/web_socket.rb +++ b/lib/web_socket.rb @@ -61,6 +61,9 @@ module Session client_ids = self.sessions client_ids.each { |client_id| + # connection already open + next if @@client_threads[client_id] + # get current user user_session = Session.get( client_id ) next if !user_session @@ -81,7 +84,7 @@ module Session # wait with client thread unil user thread has done some little work if start_user_thread - sleep 0.4 + sleep 0.5 end # start client thread @@ -484,7 +487,7 @@ class ClientState # start faster in the beginnig if loop_count < 20 - sleep 0.4 + sleep 0.6 else sleep 1 end