[fayland commit] r952 - in trunk/CPAN/TheSchwartz-Moosified: . lib/TheSchwartz

2 views
Skip to first unread message

codesite...@google.com

unread,
Feb 13, 2009, 8:36:26 PM2/13/09
to fay...@googlegroups.com
Author: fayland
Date: Fri Feb 13 17:29:46 2009
New Revision: 952

Modified:
trunk/CPAN/TheSchwartz-Moosified/Changes
trunk/CPAN/TheSchwartz-Moosified/lib/TheSchwartz/Moosified.pm

Log:
TheSchwartz::Moosified 0.02

Modified: trunk/CPAN/TheSchwartz-Moosified/Changes
==============================================================================
--- trunk/CPAN/TheSchwartz-Moosified/Changes (original)
+++ trunk/CPAN/TheSchwartz-Moosified/Changes Fri Feb 13 17:29:46 2009
@@ -1,5 +1,8 @@
Revision history for TheSchwartz-Moosified

+0.02 2009.2.14
+ fix _grab_a_job with WHERE grabbed_until = $old_grabbed_until
+
0.01 2008.11.19
rename from MooseX::TheSchwartz


Modified: trunk/CPAN/TheSchwartz-Moosified/lib/TheSchwartz/Moosified.pm
==============================================================================
--- trunk/CPAN/TheSchwartz-Moosified/lib/TheSchwartz/Moosified.pm (original)
+++ trunk/CPAN/TheSchwartz-Moosified/lib/TheSchwartz/Moosified.pm Fri Feb
13 17:29:46 2009
@@ -11,7 +11,7 @@
use TheSchwartz::Moosified::Job;
use TheSchwartz::Moosified::JobHandle;

-our $VERSION = '0.01';
+our $VERSION = '0.02';
our $AUTHORITY = 'cpan:FAYLAND';

## Number of jobs to fetch at a time in find_job_for_workers.
@@ -23,10 +23,10 @@
$msg =~ s/\s+$//;
print STDERR "$msg\n";
};
-subtype 'Verbose'
+subtype 'TheSchwartz.Moosified.Verbose'
=> as 'CodeRef'
=> where { 1; };
-coerce 'Verbose'
+coerce 'TheSchwartz.Moosified.Verbose'
=> from 'Int'
=> via {
if ($_) {
@@ -36,7 +36,7 @@
}
};

-has 'verbose' => ( is => 'rw', isa => 'Verbose', coerce => 1, default => 0
);
+has 'verbose' => ( is => 'rw', isa => 'TheSchwartz.Moosified.Verbose',
coerce => 1, default => 0 );
has 'prioritize' => ( is => 'rw', isa => 'Bool', default => 0 );

has 'retry_seconds' => (is => 'rw', isa => 'Int', default => 30);
@@ -102,10 +102,9 @@
$job->arg( Storable::nfreeze( $job->arg ) ) if ref $job->arg;

for my $dbh ( $self->shuffled_databases ) {
- my $jobid;
eval {
$job->funcid( $self->funcname_to_id( $dbh, $job->funcname ) );
- $job->insert_time(time);
+ $job->insert_time(time());

my $row = $job->as_hashref;
my @col = keys %$row;
@@ -116,7 +115,7 @@
my $sth = $dbh->prepare_cached($sql);
$sth->execute( @$row{@col} );

- $jobid = insert_id( $dbh, $sth, "job", "jobid" );
+ my $jobid = insert_id( $dbh, $sth, "job", "jobid" );
$job->jobid($jobid);
};

@@ -207,9 +206,9 @@

my $new_grabbed_until = $server_time + ($worker_class->grab_for ||
1);

- my $sql = q~UPDATE job SET grabbed_until = ? WHERE jobid = ?~;
+ my $sql = q~UPDATE job SET grabbed_until = ? WHERE jobid = ? AND
grabbed_until = ?~;
my $sth = $dbh->prepare($sql);
- $sth->execute($new_grabbed_until, $job->jobid);
+ $sth->execute($new_grabbed_until, $job->jobid, $old_grabbed_until);
my $rows = $sth->rows;

## Update the job in the database, and end the transaction.

Reply all
Reply to author
Forward
0 new messages