]> git.netwichtig.de Git - user/henk/code/ruby/rbot.git/commitdiff
bdb: support running without envs
authorGiuseppe Bilotta <giuseppe.bilotta@gmail.com>
Fri, 28 Jan 2011 09:07:44 +0000 (10:07 +0100)
committerGiuseppe Bilotta <giuseppe.bilotta@gmail.com>
Fri, 28 Jan 2011 09:07:44 +0000 (10:07 +0100)
The various checkpointing function may be called when no env has been
loaded (yet), support this.

lib/rbot/registry/bdb.rb

index 5acfe4910cd331b17fe7b3b479a121c1cab24678..4457a3693c749f25b5eb52549d4be13b05f6a7be 100644 (file)
@@ -146,6 +146,10 @@ module Irc
     end
 
     def DBTree.cleanup_logs()
+      if @@env.nil?
+        debug "No BDB environment, skipping checkpoint"
+        return
+      end
       begin
         debug "DBTree: checkpointing ..."
         @@env.checkpoint
@@ -166,6 +170,10 @@ module Irc
     end
 
     def DBTree.stats()
+      if @@env.nil?
+        debug "No BDB environment, no stats"
+        return
+      end
       begin
         debug "General stats:"
         debug @@env.stat
@@ -181,6 +189,10 @@ module Irc
     end
 
     def DBTree.cleanup_env()
+      if @@env.nil?
+        debug "No BDB environment, skipping cleanup"
+        return
+      end
       begin
         debug "DBTree: checking transactions ..."
         has_active_txn = @@env.txn_stat["st_nactive"] > 0