Skip to content

Commit

Permalink
[orchagent][PFCWD]: Clean up last duration value
Browse files Browse the repository at this point in the history
Signed-off-by: marian-pritsak <[email protected]>
  • Loading branch information
marian-pritsak committed Sep 11, 2017
1 parent d297047 commit c22321f
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion orchagent/duration_criteria.lua
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ for i = n, 1, -1 do
local pfc_rx_pkt_key = ''
local counter_num = 0
local old_counter_num = 0
local is_deadlock = false

local m = table.getn(counter_keys)
for j = m, 1, -1 do
Expand Down Expand Up @@ -67,13 +68,18 @@ for i = n, 1, -1 do
-- DEBUG CODE END.
(occupancy_bytes == 0 and packets - packets_last == 0 and (pfc_duration - pfc_duration_last) > poll_time * 0.8) then
table.insert(rets, KEYS[i])
is_deadlock = true
end
end

-- Save values for next run
redis.call('HSET', counters_table_name .. ':' .. KEYS[i], 'SAI_QUEUE_STAT_PACKETS_last', packets)
redis.call('HSET', counters_table_name .. ':' .. KEYS[i], pfc_rx_pkt_key .. '_last', pfc_rx_packets)
redis.call('HSET', counters_table_name .. ':' .. KEYS[i], pfc_duration_key .. '_last', pfc_duration)
if is_deadlock then
redis.call('HDEL', counters_table_name .. ':' .. KEYS[i], pfc_duration_key .. '_last')
else
redis.call('HSET', counters_table_name .. ':' .. KEYS[i], pfc_duration_key .. '_last', pfc_duration)
end
end
end

Expand Down

0 comments on commit c22321f

Please sign in to comment.