Skip to content

Commit

Permalink
s/callback/enqueue_time_callback/g
Browse files Browse the repository at this point in the history
  • Loading branch information
nekokak committed Nov 24, 2010
1 parent 8dc0782 commit 855dceb
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
6 changes: 3 additions & 3 deletions lib/Jonk/Client.pm
Expand Up @@ -14,7 +14,7 @@ sub new {
bless {
dbh => $dbh,
enqueue_query => sprintf('INSERT INTO %s (func, arg, enqueue_time) VALUES (?,?,?)', ($opts->{table_name}||'job')),
callback => ($opts->{callback}||sub{
enqueue_time_callback => ($opts->{enqueue_time_callback}||sub{
my ( $sec, $min, $hour, $mday, $mon, $year, $wday, $yday, $isdst ) = localtime(time);
return sprintf('%04d-%02d-%02d %02d:%02d:%02d', $year + 1900, $mon + 1, $mday, $hour, $min, $sec);
}),
Expand All @@ -29,7 +29,7 @@ sub enqueue {
local $self->{dbh}->{RaiseError} = 1;
local $self->{dbh}->{PrintError} = 0;
my $sth = $self->{dbh}->prepare_cached($self->{enqueue_query});
$sth->execute($func, $arguments->{arg}, $self->{callback}->());
$sth->execute($func, $arguments->{arg}, $self->{enqueue_time_callback}->());
$job_id = $self->_insert_id($self->{dbh});
$sth->finish;
} catch {
Expand Down Expand Up @@ -77,7 +77,7 @@ specific job table name.
Default job table name is `job`.
=item * $options->{callback}
=item * $options->{enqueue_time_callback}
specific enqueue_time creation callback.
Expand Down
4 changes: 2 additions & 2 deletions t/client.t
Expand Up @@ -33,9 +33,9 @@ subtest 'enqueue' => sub {
done_testing;
};

subtest 'enqueue / and callback' => sub {
subtest 'enqueue / and enqueue_time_callback' => sub {
my $time;
my $jonk = Jonk::Client->new($dbh,+{callback => sub {
my $jonk = Jonk::Client->new($dbh,+{enqueue_time_callback => sub {
my ( $sec, $min, $hour, $mday, $mon, $year, $wday, $yday, $isdst ) = localtime(time);
$time = sprintf('%04d-%02d-%02d %02d:%02d:%02d', $year + 1900, $mon + 1, $mday, $hour, $min, $sec);
}});
Expand Down

0 comments on commit 855dceb

Please sign in to comment.