From 338fc30b90bd0745ade5c3e507176da262e75d66 Mon Sep 17 00:00:00 2001 From: Javi Fontan Date: Tue, 17 Oct 2017 16:15:34 +0200 Subject: [PATCH] B #5460: onedb purge-size check seq number (cherry picked from commit 23fe16454e700c4df1172130139b94bec435d7ed) --- src/onedb/onedb_live.rb | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/onedb/onedb_live.rb b/src/onedb/onedb_live.rb index 13d6ec236f..67c030f206 100644 --- a/src/onedb/onedb_live.rb +++ b/src/onedb/onedb_live.rb @@ -147,7 +147,10 @@ class OneDBLive history_num = 2 - if Array === val_history && val_history.size > history_num + val_history = [val_history].flatten + last_seq = val_history.last['SEQ'].to_i rescue 0 + + if last_seq >= history_num last_history = val_history.last(history_num) old_seq = [] @@ -178,6 +181,8 @@ class OneDBLive # Renumerate sequence numbers old_seq.each_with_index do |seq, index| row = history.find {|r| seq.to_s == r["seq"] } + next if !row + body = Base64.decode64(row['body64']) doc = Nokogiri::XML(body)