diff options
author | Giuseppe Bilotta <giuseppe.bilotta@gmail.com> | 2006-08-05 12:20:46 +0000 |
---|---|---|
committer | Giuseppe Bilotta <giuseppe.bilotta@gmail.com> | 2006-08-05 12:20:46 +0000 |
commit | 27a1965cc7b57e9de6d69504faaa3915a7cc959e (patch) | |
tree | 58f487333d5458224859d6370b5f2a3a2756b51f | |
parent | 3b99e8a0cbe61aa6ad025eb47f8487d947047b3f (diff) |
Fix some save/quit/rescan races
-rw-r--r-- | lib/rbot/ircbot.rb | 10 | ||||
-rw-r--r-- | 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 |