-
-
Save anonymous/2397c84a89af1e4dfd06 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# A (original) | |
my $db = $self->pg->db; | |
return $db->query( | |
"insert into minion_jobs | |
(args, created, delayed, priority, retries, state, task) | |
values | |
(?, now(), (now() + (interval '1 second' * ?)), ?, ?, ?, ?) | |
returning id", encode_json($args), $options->{delay} // 0, | |
$options->{priority} // 0, 0, 'inactive', $task | |
)->hash->{id}; | |
# B | |
my $db = $self->pg->db; | |
$db->json($args)->val( | |
$options->{delay} // 0, | |
$options->{priority} // 0, | |
0, 'inactive', $task | |
); | |
return $db->query( | |
"insert into minion_jobs | |
(args, created, delayed, priority, retries, state, task) | |
values | |
(?, now(), (now() + (interval '1 second' * ?)), ?, ?, ?, ?) | |
returning id" | |
)->hash->{id}; | |
# C | |
my $db = $self->pg->db; | |
my $sql = $db->sql( | |
"insert into minion_jobs | |
(args, created, delayed, priority, retries, state, task) | |
values | |
(?, now(), (now() + (interval '1 second' * ?)), ?, ?, ?, ?) | |
returning id" | |
); | |
$sql->json($args)->val( | |
$options->{delay} // 0, | |
$options->{priority} // 0, | |
0, 'inactive', $task | |
); | |
return $sql->run->hash->{id}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment