Improved re-push of changed and already pushed data.

This commit is contained in:
Martin Edenhofer 2012-12-15 00:24:59 +01:00
parent 419ed6571c
commit 17de3107d4

View file

@ -447,6 +447,8 @@ class ClientState
CacheIn.set( 'last_run_' + user.id.to_s , true, { :expires_in => 20.seconds } )
# verify already pushed data
if !CacheIn.get( 'pushed_users' + @client_id.to_s )
CacheIn.set( 'pushed_users' + @client_id.to_s , true, { :expires_in => 15.seconds } )
if @pushed[:users]
users = {}
@pushed[:users].each {|user_id, user_o|
@ -467,8 +469,11 @@ class ClientState
});
end
end
end
# verify already pushed data
if !CacheIn.get( 'pushed_tickets' + @client_id.to_s )
CacheIn.set( 'pushed_tickets' + @client_id.to_s , true, { :expires_in => 15.seconds } )
if @pushed[:tickets]
tickets = []
users = {}
@ -476,8 +481,8 @@ class ClientState
self.ticket( ticket_id, tickets, users )
}
if !tickets.empty?
tickets.each {|ticket_id|
self.log 'notify', "push update of already pushed ticket id #{ticket_id}"
tickets.each {|ticket|
self.log 'notify', "push update of already pushed ticket id #{ticket['id']}"
}
# send update to browser
self.send({
@ -491,6 +496,7 @@ class ClientState
});
end
end
end
# overview
cache_key = @cache_key + '_overview'