[Bps-public-commit] smokingit branch, master, updated. bad7de1e4a46b26e269f931ed42cfd339e5ff43e
Alex Vandiver
alexmv at bestpractical.com
Mon May 27 13:18:51 EDT 2013
The branch, master has been updated
via bad7de1e4a46b26e269f931ed42cfd339e5ff43e (commit)
from 0bfe0a88c765fdf1ab8db22e97c9bc54b8ee79a1 (commit)
Summary of changes:
bin/local_updates | 14 +++++++++++---
1 file changed, 11 insertions(+), 3 deletions(-)
- Log -----------------------------------------------------------------
commit bad7de1e4a46b26e269f931ed42cfd339e5ff43e
Author: Alex Vandiver <alexmv at bestpractical.com>
Date: Mon May 27 13:17:28 2013 -0400
Deal with out-of-order test completion and progress messages
It is possible for local_updates to handle the posted result of the test
before the "100% complete" message is received. Ensure that we do not
push a finished test back into appearing to be "in progress" by updating
the now-NULL queue status to be "100% complete" if they arrive
out-of-order.
diff --git a/bin/local_updates b/bin/local_updates
index 681ad31..74eba73 100755
--- a/bin/local_updates
+++ b/bin/local_updates
@@ -84,6 +84,7 @@ $listen->poll(
my $smoke = Smokingit::Model::SmokeResult->new(
current_user => Smokingit::CurrentUser->superuser,
);
+ Jifty->handle->begin_transaction;
$smoke->load( $message{smoke_id} );
my $status = Smokingit::Status->new( $smoke );
if ($message{status} eq "started") {
@@ -91,12 +92,19 @@ $listen->poll(
} elsif ($message{status} eq "configuring") {
$smoke->set_queue_status("Configuring");
} elsif ($message{status} eq "testing") {
- my $fraction = $message{complete}/($message{total} || 1);
- $smoke->set_queue_status(
- int($fraction*100) ."% complete");
+ if ($smoke->queue_status) {
+ my $fraction = $message{complete}/($message{total} || 1);
+ warn "$fraction complete";
+ $smoke->set_queue_status(
+ int($fraction*100) ."% complete");
+ } else {
+ warn "Already complete!";
+ }
} else {
warn "Unknown worker status: $message{status}";
}
+ Jifty->handle->commit;
+
$status->publish;
}
);
-----------------------------------------------------------------------
More information about the Bps-public-commit
mailing list