Skip to content

Periodic sync. may stop when fatal error occurs in sync function. #2

Open

Description

@masiuchi

This will be fixed after reporting the error by users.

Activity

  1. masiuchi commented on Mar 27, 2015

    @masiuchi
    ContributorAuthor

    Rough patch. This is not checked.

    diff --git a/plugins/PeriodicSync/lib/PeriodicSync.pm b/plugins/PeriodicSync/lib/PeriodicSync.
    index 2a1891d..ef1d1e8 100644
    --- a/plugins/PeriodicSync/lib/PeriodicSync.pm
    +++ b/plugins/PeriodicSync/lib/PeriodicSync.pm
    @@ -22,7 +22,9 @@ sub override {

    sub work {
    my ( $class, $job ) = @
    ;

    • $work->( $class, $job );
    • eval { $work->( $class, $job ) };
    • my $error = $@;

    Do nothing when an error occurs.

    if (MT::TheSchwartz::Job->exist(
    @@ -30,7 +32,8 @@ sub _work {
    )
    )
    {

    •    return;
      
    •    if   ($error) { die $error }
      
    •    else          {return}
      

      }

      my $plugin = MT->component('PeriodicSync');
      @@ -45,7 +48,8 @@ sub _work {
      && $sync_period
      && $sync_period =~ m/^\d+$/ )
      {

    •    return;
      
    •    if   ($error) { die $error }
      
    •    else          {return}
      

      }

      my $epoch = ts2epoch( undef, $sync_setting->schedule_date );
      @@ -60,7 +64,8 @@ sub _work {
      $job->run_after($epoch);
      $job->save or die $job->errstr;

    • return;

    • if ($error) { die $error }

    • else {return}
      }

    1;

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions