From 27a1965cc7b57e9de6d69504faaa3915a7cc959e Mon Sep 17 00:00:00 2001 From: Giuseppe Bilotta Date: Sat, 5 Aug 2006 12:20:46 +0000 Subject: Fix some save/quit/rescan races --- lib/rbot/ircbot.rb | 10 +++++++--- lib/rbot/plugins.rb | 4 +--- 2 files changed, 8 insertions(+), 6 deletions(-) diff --git a/lib/rbot/ircbot.rb b/lib/rbot/ircbot.rb index d83a5fe4..f5250b9b 100644 --- a/lib/rbot/ircbot.rb +++ b/lib/rbot/ircbot.rb @@ -809,7 +809,9 @@ class IrcBot debug "Saving" save debug "Cleaning up" - @plugins.cleanup + @save_mutex.synchronize do + @plugins.cleanup + end # debug "Closing registries" # @registry.close debug "Cleaning up the db environment" @@ -848,8 +850,10 @@ class IrcBot # call the rescan method for all of the botmodules def rescan - @lang.rescan - @plugins.rescan + @save_mutex.synchronize do + @lang.rescan + @plugins.rescan + end end # channel:: channel to join diff --git a/lib/rbot/plugins.rb b/lib/rbot/plugins.rb index b55fbe4a..848240cf 100644 --- a/lib/rbot/plugins.rb +++ b/lib/rbot/plugins.rb @@ -417,9 +417,7 @@ module Plugins # call the cleanup method for each active plugin def cleanup - @bot.save_mutex.synchronize do - delegate 'cleanup' - end + delegate 'cleanup' reset_botmodule_lists end -- cgit v1.2.3