Changeset 18353 for lang/perl

Show
Ignore:
Timestamp:
08/28/08 06:20:29 (3 months ago)
Author:
miyagawa
Message:

move the default value set in Job->new. Set run_after to the current time.

Location:
lang/perl/TheSchwartz-Simple/trunk/lib/TheSchwartz
Files:
2 modified

Legend:

Unmodified
Added
Removed
  • lang/perl/TheSchwartz-Simple/trunk/lib/TheSchwartz/Simple.pm

    r18351 r18353  
    3030    } 
    3131    $job->arg( Storable::nfreeze($job->arg) ) if ref $job->arg; 
    32  
    33     # Use default value if 'run_after' or 'grabbed_until' is not specified 
    34     $job->run_after( 0 ) unless $job->run_after; 
    35     $job->grabbed_until( 0 ) unless $job->grabbed_until; 
    3632 
    3733    for my $dbh (@{$self->{databases}}) { 
  • lang/perl/TheSchwartz-Simple/trunk/lib/TheSchwartz/Simple/Job.pm

    r18314 r18353  
    44sub new_from_array { 
    55    my($class, $funcname, $arg) = @_; 
    6     bless { 
     6    $class->new( 
    77        funcname => $funcname, 
    88        arg      => $arg, 
    9     }, $class; 
     9    ); 
    1010} 
    1111 
     
    1313    my $class = shift; 
    1414    my %param = ref $_[0] ? %{$_[0]} : @_; 
    15     bless \%param, $class; 
     15    my $self = bless \%param, $class; 
     16 
     17    $self->run_after( time ) unless defined $self->run_after; 
     18    $self->grabbed_until( 0) unless defined $self->grabbed_until; 
     19 
     20    $self; 
    1621} 
    1722