#958 make job queue updates work reliably and atomically
This commit is contained in:
3
Changes
3
Changes
@@ -3,7 +3,8 @@
|
|||||||
[BUG FIXES]
|
[BUG FIXES]
|
||||||
|
|
||||||
* #953 port reconfig (vlan) fail due to missing DB column data
|
* #953 port reconfig (vlan) fail due to missing DB column data
|
||||||
* #957 race condition in job queue management when deleting one job
|
* #957 make job queue updates work reliably and atomically
|
||||||
|
* #958 make job queue updates work reliably and atomically
|
||||||
|
|
||||||
2.060003 - 2022-12-14
|
2.060003 - 2022-12-14
|
||||||
|
|
||||||
|
|||||||
@@ -249,7 +249,7 @@ sub jq_defer {
|
|||||||
|
|
||||||
# lock db row and update to show job is available
|
# lock db row and update to show job is available
|
||||||
schema(vars->{'tenant'})->resultset('Admin')
|
schema(vars->{'tenant'})->resultset('Admin')
|
||||||
->find($job->id, {for => 'update'})
|
->search({ job => $job->id }, { for => 'update' })
|
||||||
->update({ status => 'queued', started => undef });
|
->update({ status => 'queued', started => undef });
|
||||||
});
|
});
|
||||||
$happy = true;
|
$happy = true;
|
||||||
@@ -280,7 +280,8 @@ sub jq_complete {
|
|||||||
}
|
}
|
||||||
|
|
||||||
schema(vars->{'tenant'})->resultset('Admin')
|
schema(vars->{'tenant'})->resultset('Admin')
|
||||||
->find($job->id, {for => 'update'})->update({
|
->search({ job => $job->id }, { for => 'update' })
|
||||||
|
->update({
|
||||||
status => $job->status,
|
status => $job->status,
|
||||||
log => $job->log,
|
log => $job->log,
|
||||||
started => $job->started,
|
started => $job->started,
|
||||||
@@ -385,8 +386,7 @@ sub jq_delete {
|
|||||||
|
|
||||||
if ($id) {
|
if ($id) {
|
||||||
schema(vars->{'tenant'})->txn_do(sub {
|
schema(vars->{'tenant'})->txn_do(sub {
|
||||||
my $job = schema(vars->{'tenant'})->resultset('Admin')->find($id);
|
schema(vars->{'tenant'})->resultset('Admin')->search({ job => $id })->delete;
|
||||||
$job->delete() if $job;
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
|||||||
Reference in New Issue
Block a user