Moved to use current user model, also if attributes has changed.

This commit is contained in:
Martin Edenhofer 2013-10-01 20:34:45 +02:00
parent 9123533f1b
commit 9950ede40a
2 changed files with 7 additions and 11 deletions

View file

@ -58,8 +58,6 @@ class Sessions::Client
end
end
# 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 => 60.seconds } )

View file

@ -1,21 +1,19 @@
class Sessions::Worker
def initialize( user_id )
@user_id = user_id
@data = {}
@cache_key = 'user_' + user_id.to_s
self.log 'notify', "---user started user state"
Sessions::CacheIn.set( 'last_run_' + user_id.to_s , true, { :expires_in => 20.seconds } )
user = User.find( @user_id )
return if !user
self.fetch( user )
self.fetch( user_id )
end
def fetch(user)
def fetch(user_id)
while true
user = User.lookup( :id => user_id )
return if !user
# check if user is still with min one open connection
if !Sessions::CacheIn.get( 'last_run_' + user.id.to_s )
@ -24,6 +22,7 @@ class Sessions::Worker
end
self.log 'notice', "---user - fetch user data"
# overview
Sessions::Backend::TicketOverviewIndex.worker( user, self )
@ -54,5 +53,4 @@ class Sessions::Worker
return if level == 'notice'
puts "#{Time.now}:user_id(#{ @user_id }) #{ data }"
end
end
end