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-04-15 04:51 pm

[dw-free] Allow importing of your journal from another LiveJournal-based site.

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

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

Comment/Entry imports can take a while, so let's not have them time out and
create duplicates.

Patch by [staff profile] mark.

Files modified:
  • cgi-bin/DW/Worker/ContentImporter/LiveJournal/Comments.pm
  • cgi-bin/DW/Worker/ContentImporter/LiveJournal/Entries.pm
--------------------------------------------------------------------------------
diff -r 230f04d75396 -r 8f81aa1bbd24 cgi-bin/DW/Worker/ContentImporter/LiveJournal/Comments.pm
--- a/cgi-bin/DW/Worker/ContentImporter/LiveJournal/Comments.pm	Wed Apr 15 16:29:56 2009 +0000
+++ b/cgi-bin/DW/Worker/ContentImporter/LiveJournal/Comments.pm	Wed Apr 15 16:51:24 2009 +0000
@@ -43,6 +43,11 @@ sub try_work {
     my $opts = $job->arg;
     my $data = $class->import_data( $opts->{userid}, $opts->{import_data_id} );
     my $begin_time = [ gettimeofday() ];
+
+    # we know that we can potentially take a while, so budget a few hours for
+    # the import job before someone else comes in to snag it
+    $job->grabbed_until( time() + 3600*12 );
+    $job->save;
 
     # failure wrappers for convenience
     my $fail      = sub { return $class->fail( $data, 'lj_comments', $job, @_ ); };
diff -r 230f04d75396 -r 8f81aa1bbd24 cgi-bin/DW/Worker/ContentImporter/LiveJournal/Entries.pm
--- a/cgi-bin/DW/Worker/ContentImporter/LiveJournal/Entries.pm	Wed Apr 15 16:29:56 2009 +0000
+++ b/cgi-bin/DW/Worker/ContentImporter/LiveJournal/Entries.pm	Wed Apr 15 16:51:24 2009 +0000
@@ -41,6 +41,11 @@ sub try_work {
     my $opts = $job->arg;
     my $data = $class->import_data( $opts->{userid}, $opts->{import_data_id} );
     my $begin_time = [ gettimeofday() ];
+
+    # we know that we can potentially take a while, so budget a few hours for
+    # the import job before someone else comes in to snag it
+    $job->grabbed_until( time() + 3600*12 );
+    $job->save;
 
     # failure wrappers for convenience
     my $fail      = sub { return $class->fail( $data, 'lj_entries', $job, @_ ); };
--------------------------------------------------------------------------------