mark: A photo of Mark kneeling on top of the Taal Volcano in the Philippines. It was a long hike. (Default)
Mark Smith ([staff profile] mark) wrote in [site community profile] changelog2009-05-17 02:48 am

[dw-free] invite code distribution failing

[commit: http://hg.dwscoalition.org/dw-free/rev/184bda4c9784]

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

Make invite code distribution work in production again.

Patch by [staff profile] mark.

Files modified:
  • cgi-bin/ljdb.pl
--------------------------------------------------------------------------------
diff -r 019a523054f5 -r 184bda4c9784 cgi-bin/ljdb.pl
--- a/cgi-bin/ljdb.pl	Sun May 17 02:42:16 2009 +0000
+++ b/cgi-bin/ljdb.pl	Sun May 17 02:48:00 2009 +0000
@@ -521,6 +521,12 @@ sub foreach_cluster {
 sub foreach_cluster {
     my $coderef = shift;
     my $opts = shift || {};
+
+    # have to include this via an eval so it doesn't actually get included
+    # until someone calls foreach cluster.  at which point, if they're in web
+    # context, it will fail.
+    eval "use LJ::DBUtil; 1;";
+    die $@ if $@;
     
     foreach my $cluster_id (@LJ::CLUSTERS) {
         my $dbr = ($LJ::IS_DEV_SERVER) ?
--------------------------------------------------------------------------------

(Anonymous) 2009-05-17 12:53 pm (UTC)(link)
/me reverts one of the changes he made to fix stats. Hmm, why does LJ::DBUtil resist being loaded in web comtext anyway?
pauamma: Cartooney crab wearing hot pink and acid green facemask holding drink with straw (Default)

[personal profile] pauamma 2009-05-17 12:54 pm (UTC)(link)
That was me.
pauamma: Cartooney crab wearing hot pink and acid green facemask holding drink with straw (Default)

[personal profile] pauamma 2009-05-17 08:48 pm (UTC)(link)
Hmm, yes. Perhaps there should be a better way to do this? Perhaps move foreach_cluster from ljdb.pl (which puts it under LJ::) to here and move the die to within get_inactive_db? (It's not like there would be a gazillion calls to change.)

Or should this discussion be moved to dw_dev?
pauamma: Cartooney crab wearing hot pink and acid green facemask holding drink with straw (Default)

[personal profile] pauamma 2009-05-17 11:44 pm (UTC)(link)
Cleaner IMO, by avoiding a runtime eval "use foo". Maybe something to consider if and when we refactor ljdb.pl as a proper module?