From d1c7a0f29fb54c838ba8cd7dd90b0c3d8a3fae5b Mon Sep 17 00:00:00 2001 From: Martin Edenhofer Date: Sun, 22 Sep 2013 01:12:25 +0200 Subject: [PATCH] Moved to loadAssets event. --- lib/sessions/client.rb | 24 +++++++++++------------- 1 file changed, 11 insertions(+), 13 deletions(-) diff --git a/lib/sessions/client.rb b/lib/sessions/client.rb index a2dfbc969..15ba61076 100644 --- a/lib/sessions/client.rb +++ b/lib/sessions/client.rb @@ -31,9 +31,9 @@ class Sessions::Client # remember last run Sessions::CacheIn.set( 'last_run_' + user.id.to_s , true, { :expires_in => 20.seconds } ) - # verify already pushed data + # verify already pushed data, send update if needed if !Sessions::CacheIn.get( 'pushed_users' + @client_id.to_s ) - Sessions::CacheIn.set( 'pushed_users' + @client_id.to_s , true, { :expires_in => 20.seconds } ) + Sessions::CacheIn.set( 'pushed_users' + @client_id.to_s , true, { :expires_in => 60.seconds } ) if @pushed[:users] users = {} @pushed[:users].each {|user_id, user_o| @@ -46,19 +46,19 @@ class Sessions::Client # send update to browser self.send({ :data => { - :collections => { - User.to_app_model => users, - }, + User.to_app_model => users, }, - :event => [ 'loadCollection', 'ticket_overview_rebuild' ], + :event => [ 'loadAssets' ], }); end end end - # verify already pushed data + + + # verify already pushed data, send update if needed if !Sessions::CacheIn.get( 'pushed_tickets' + @client_id.to_s ) - Sessions::CacheIn.set( 'pushed_tickets' + @client_id.to_s , true, { :expires_in => 20.seconds } ) + Sessions::CacheIn.set( 'pushed_tickets' + @client_id.to_s , true, { :expires_in => 60.seconds } ) if @pushed[:tickets] tickets = {} users = {} @@ -72,12 +72,10 @@ class Sessions::Client # send update to browser self.send({ :data => { - :collections => { - Ticket.to_app_model => tickets, - User.to_app_model => users, - }, + Ticket.to_app_model => tickets, + User.to_app_model => users, }, - :event => [ 'loadCollection', 'ticket_overview_rebuild' ], + :event => [ 'loadAssets' ], }); end end