Added logging to find race condition.
This commit is contained in:
parent
17d499cbe3
commit
fbd99e89f3
3 changed files with 26 additions and 4 deletions
|
@ -15,10 +15,17 @@ class Sessions::Backend::TicketOverviewIndex
|
|||
current_user: @user,
|
||||
)
|
||||
|
||||
if !overview || overview.empty?
|
||||
Rails.logger.debug "ERR no overview for #{@user.inspect}/#{overview.isnpect}"
|
||||
end
|
||||
|
||||
# no data exists
|
||||
return if !overview
|
||||
|
||||
# no change exists
|
||||
if @last_change == overview
|
||||
Rails.logger.debug "ERR @last_change == overview #{@user.inspect}/#{overview.isnpect}"
|
||||
end
|
||||
return if @last_change == overview
|
||||
|
||||
# remember last state
|
||||
|
@ -33,6 +40,10 @@ class Sessions::Backend::TicketOverviewIndex
|
|||
|
||||
def push
|
||||
|
||||
if Sessions::CacheIn.get( client_key )
|
||||
Rails.logger.debug "ERR CACHE FILLED #{@client_key}"
|
||||
end
|
||||
|
||||
# check check interval
|
||||
return if Sessions::CacheIn.get( client_key )
|
||||
|
||||
|
@ -41,11 +52,13 @@ class Sessions::Backend::TicketOverviewIndex
|
|||
|
||||
# check if min one ticket has changed
|
||||
last_ticket_change = Ticket.latest_change
|
||||
Rails.logger.debug "ERR last_ticket_change #{last_ticket_change}"
|
||||
return if last_ticket_change == @last_ticket_change
|
||||
@last_ticket_change = last_ticket_change
|
||||
|
||||
# load current data
|
||||
data = load
|
||||
Rails.logger.debug "ERR push/load #{data.inspect}"
|
||||
|
||||
return if !data
|
||||
|
||||
|
|
|
@ -24,7 +24,9 @@ class Sessions::Backend::TicketOverviewList
|
|||
data = { list: overview_data, index: overview }
|
||||
result.push data
|
||||
}
|
||||
Rails.logger.debug "LOG A #{result.inspect}"
|
||||
if !result || result.empty?
|
||||
Rails.logger.debug "LOG A PROBLEM #{result.inspect} / #{@last_change}"
|
||||
end
|
||||
# no data exists
|
||||
return if !result || result.empty?
|
||||
|
||||
|
@ -45,7 +47,9 @@ class Sessions::Backend::TicketOverviewList
|
|||
def push
|
||||
|
||||
# check interval
|
||||
Rails.logger.debug "LOG 1 #{@user.inspect}"
|
||||
if Sessions::CacheIn.get( client_key )
|
||||
Rails.logger.debug "LOG 1 CACH KEY EXISTS #{@user.inspect}"
|
||||
end
|
||||
return if Sessions::CacheIn.get( client_key )
|
||||
|
||||
# reset check interval
|
||||
|
@ -54,13 +58,15 @@ class Sessions::Backend::TicketOverviewList
|
|||
|
||||
# check if min one ticket has changed
|
||||
last_ticket_change = Ticket.latest_change
|
||||
if last_ticket_change == @last_ticket_change
|
||||
Rails.logger.debug "LOG 3 #{last_ticket_change}/#{@last_ticket_change}"
|
||||
end
|
||||
return if last_ticket_change == @last_ticket_change
|
||||
@last_ticket_change = last_ticket_change
|
||||
|
||||
# load current data
|
||||
items = load
|
||||
Rails.logger.debug "LOG 4 #{items.inspect}"
|
||||
Rails.logger.debug "LOG 4 set new from load #{items.inspect}"
|
||||
return if !items
|
||||
|
||||
# push overviews
|
||||
|
|
|
@ -29,6 +29,9 @@ class SessionBasicTicketTest < ActiveSupport::TestCase
|
|||
|
||||
# get as stream
|
||||
result1 = client1.push
|
||||
if !result1
|
||||
Rails.logger.debug "FAILD Sessions::Backend::TicketOverviewIndex push"
|
||||
end
|
||||
assert( result1, 'check ticket_overview_index' )
|
||||
|
||||
# next check should be empty / no changes
|
||||
|
|
Loading…
Reference in a new issue