kareila: (Default)
kareila ([personal profile] kareila) wrote in [site community profile] changelog2010-09-12 06:24 pm

[dw-free] update LJ::MOGILEFS_CONFIG to support replication policies

[commit: http://hg.dwscoalition.org/dw-free/rev/75db4193e08b]

http://bugs.dwscoalition.org/show_bug.cgi?id=2928

Clarify defaults for MogileFS configuration.

Patch by [personal profile] kareila.

Files modified:
  • cgi-bin/ljdefaults.pl
  • cgi-bin/ljlib.pl
--------------------------------------------------------------------------------
diff -r b742d4633e8c -r 75db4193e08b cgi-bin/ljdefaults.pl
--- a/cgi-bin/ljdefaults.pl	Sat Sep 11 09:10:59 2010 -0500
+++ b/cgi-bin/ljdefaults.pl	Sun Sep 12 13:24:13 2010 -0500
@@ -181,7 +181,10 @@ no strict "vars";
     # indicating where to reach your local MogileFS server.
     %MOGILEFS_CONFIG = () unless defined %MOGILEFS_CONFIG;
     $MOGILEFS_CONFIG{domain}                 ||= 'livejournal';
+    $MOGILEFS_CONFIG{timeout}                ||= 3;
+
     $MOGILEFS_CONFIG{classes}                ||= {};
+    $MOGILEFS_CONFIG{classes}->{temp}        ||= 2;
     $MOGILEFS_CONFIG{classes}->{userpics}    ||= 3;
 
     # Default to allow all reproxying.
@@ -240,17 +243,6 @@ no strict "vars";
     }
 
     $USERPROP_DEF{'blob_clusterid'} ||= 1;
-
-    # setup default limits for mogilefs classes
-    if (%LJ::MOGILEFS_CONFIG) {
-        my %classes = (userpics => 3,
-                       temp => 2,
-                       );
-        $LJ::MOGILEFS_CONFIG{classes} ||= {};
-        foreach my $class (keys %classes) {
-            $LJ::MOGILEFS_CONFIG{classes}{$class} ||= $classes{$class};
-        }
-    }
 
     # random user defaults to a week
     $RANDOM_USER_PERIOD = 7;
diff -r b742d4633e8c -r 75db4193e08b cgi-bin/ljlib.pl
--- a/cgi-bin/ljlib.pl	Sat Sep 11 09:10:59 2010 -0500
+++ b/cgi-bin/ljlib.pl	Sun Sep 12 13:24:13 2010 -0500
@@ -318,7 +318,7 @@ sub mogclient {
                                       root   => $LJ::MOGILEFS_CONFIG{root},
                                       hosts  => $LJ::MOGILEFS_CONFIG{hosts},
                                       readonly => $LJ::DISABLE_MEDIA_UPLOADS,
-                                      timeout => $LJ::MOGILEFS_CONFIG{timeout} || 3,
+                                      timeout => $LJ::MOGILEFS_CONFIG{timeout},
                                       )
             or die "Could not initialize MogileFS";
 
--------------------------------------------------------------------------------