Item10299: DBCachePlugins::WebDB should retry when reading the cache file fails
Priority: Enhancement
Current State: No Action Required
Released In: n/a
Target Release: n/a
Some time ago I made the following patch for
DBCachePlugins WebDB.pm cause some DBD archivists had trouble with the cache file.
I forgot about the patch and never used it in a production environment. Maybe somebody else finds it useful.
Index: WebDB.pm
===================================================================
--- WebDB.pm (Revision 10299)
+++ WebDB.pm (Arbeitskopie)
@@ -75,8 +75,18 @@
# WARNING: this breaks on Archivists that are not file-based
sub _getCacheFile {
my $this = shift;
+ my $retries = 0;
my $cacheFile = $this->{archivist}->{_file};
+
+ # on some BDB Archivists the above returns undef sometimes
+ my $maxRetries = $Foswiki::cfg{DBCache}{MaxRetries} || 5;
+ while ( (not defined $cacheFile) && ($retries <= $maxRetries) ) {
+ $retries++;
+ sleep(0.5);
+ $cacheFile = $this->{archivist}->{_file};
+ }
+
writeDebug("cacheFile=$cacheFile");
return $cacheFile if -f $cacheFile;
--
OliverKrueger - 31 Jan 2011