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] changelog2011-12-29 09:30 pm

[dw-free] The entry importer wasn't using the remap cache (what!), fixed

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

The entry importer wasn't using the remap cache (what!), fixed

Patch by [staff profile] mark.

Files modified:
  • cgi-bin/DW/Worker/ContentImporter/LiveJournal/Entries.pm
--------------------------------------------------------------------------------
diff -r 11a1f280a6bf -r f6ef8b023acd cgi-bin/DW/Worker/ContentImporter/LiveJournal/Entries.pm
--- a/cgi-bin/DW/Worker/ContentImporter/LiveJournal/Entries.pm	Thu Dec 29 21:29:28 2011 +0000
+++ b/cgi-bin/DW/Worker/ContentImporter/LiveJournal/Entries.pm	Thu Dec 29 21:34:27 2011 +0000
@@ -190,9 +190,6 @@
         return $sync{$id}->[1] if @{$sync{$id} || []};
     };
 
-    # helper so we don't have to get so much FOAF data
-    my %user_map;
-
     # now get the actual events
     while ( scalar( keys %sync ) > 0 ) {
         my ( $count, $last_itemid ) = ( 0, undef );
@@ -246,13 +243,9 @@
             # now try to determine if we need to post this as a user
             my $posteru;
             if ( $data->{usejournal} ) {
-                my $posterid = exists $user_map{$evt->{poster}} ? $user_map{$evt->{poster}} :
-                    DW::Worker::ContentImporter::LiveJournal->remap_username_friend( $data, $evt->{poster} );
+                my ( $posterid, $fid ) = $class->get_remapped_userids( $data, $evt->{poster} );
 
                 unless ( $posterid ) {
-                    # set it to 0, but exists, so we don't hit LJ again, but we continue to fail this poster
-                    $user_map{$evt->{poster}} = 0;
-
                     # FIXME: need a better way of totally dying...
                     push @item_errors, "Unable to map poster from LJ user '$evt->{poster}' to local user.";
                     $status->(
@@ -262,7 +255,6 @@
                     return;
                 }
 
-                $user_map{$evt->{poster}} ||= $posterid;
                 $posteru = LJ::load_userid( $posterid );
             }
 
--------------------------------------------------------------------------------