summaryrefslogtreecommitdiff
path: root/data
diff options
context:
space:
mode:
authorGiuseppe Bilotta <giuseppe.bilotta@gmail.com>2012-08-31 21:04:47 +0200
committerGiuseppe Bilotta <giuseppe.bilotta@gmail.com>2012-08-31 21:04:47 +0200
commit211e189e0308ae15a993012e82773204f36da783 (patch)
treea4a13f90ccbeb83c7bedd6d500e63781cf383f2b /data
parent5c9579c4272f20480c7449511b76019fd41d21f4 (diff)
markov: be more robust about flaky dbs
Due to historical bugs, some database entries may have ended up being serialized as strings. Recover from this by making them into arrays.
Diffstat (limited to 'data')
-rwxr-xr-xdata/rbot/plugins/markov.rb4
1 files changed, 4 insertions, 0 deletions
diff --git a/data/rbot/plugins/markov.rb b/data/rbot/plugins/markov.rb
index 621935c6..eb9294e2 100755
--- a/data/rbot/plugins/markov.rb
+++ b/data/rbot/plugins/markov.rb
@@ -183,6 +183,9 @@ class MarkovPlugin < Plugin
@upgrade_queue.push nil
@upgrade_thread = Thread.new do
+ @registry.recovery = Proc.new { |val|
+ return [val]
+ }
logfile = File.open(@bot.path('markov-conversion.log'), 'a')
logfile.puts "=== conversion thread started #{Time.now} ==="
while k = @upgrade_queue.pop
@@ -199,6 +202,7 @@ class MarkovPlugin < Plugin
end
logfile.puts "=== conversion thread stopped #{Time.now} ==="
logfile.close
+ @registry.recovery = nil
end
@upgrade_thread.priority = -1
end