aboutsummaryrefslogtreecommitdiff
path: root/mod/mod-build-task.cxx
diff options
context:
space:
mode:
authorKaren Arutyunov <karen@codesynthesis.com>2023-04-13 19:36:23 +0300
committerKaren Arutyunov <karen@codesynthesis.com>2023-04-14 12:27:01 +0300
commit531943d795a2a01e7293af6fd724e626b91156c9 (patch)
tree47cec76fa7babc0761f4e2b5155f0203326507f8 /mod/mod-build-task.cxx
parent43a47ce352dc43662dc5a59123ce4823e9ba7189 (diff)
Add support for interrupt build result status
Diffstat (limited to 'mod/mod-build-task.cxx')
-rw-r--r--mod/mod-build-task.cxx27
1 files changed, 14 insertions, 13 deletions
diff --git a/mod/mod-build-task.cxx b/mod/mod-build-task.cxx
index bd5034b..9ce2520 100644
--- a/mod/mod-build-task.cxx
+++ b/mod/mod-build-task.cxx
@@ -720,25 +720,19 @@ handle (request& rq, response& rs)
b.hard_timestamp <= hard_rebuild_expiration;
};
- // Convert a build to the hard rebuild, resetting the agent checksum and
- // dropping the previous build task result.
+ // Convert a build to the hard rebuild, resetting the agent checksum.
//
// Note that since the checksums are hierarchical, the agent checksum
// reset will trigger resets of the "subordinate" checksums up to the
// dependency checksum and so the package will be rebuilt.
//
- // Also note that there is no sense to keep the build task result since we
- // don't accept the skip result for the hard rebuild task. We, however,
- // keep the status intact (see below for the reasoning).
+ // Also note that we keep the previous build task result and status
+ // intact since we may still need to revert the build into the built
+ // state if the task execution is interrupted.
//
auto convert_to_hard = [] (const shared_ptr<build>& b)
{
b->agent_checksum = nullopt;
-
- // Mark the section as loaded, so results are updated.
- //
- b->results_section.load ();
- b->results.clear ();
};
// Return SHA256 checksum of the controller logic and the configuration
@@ -1051,8 +1045,9 @@ handle (request& rq, response& rs)
// Note that in both cases we keep the status intact to be
// able to compare it with the final one in the result
// request handling in order to decide if to send the
- // email. The same is true for the forced flag (in the sense
- // that we don't set the force state to unforced).
+ // notification email or to revert it to the built state if
+ // interrupted. The same is true for the forced flag (in
+ // the sense that we don't set the force state to unforced).
//
assert (b->state == build_state::building);
@@ -1139,7 +1134,13 @@ handle (request& rq, response& rs)
if (x->status != y->status)
return x->status > y->status; // Larger status goes first.
- return x->timestamp < y->timestamp; // Older goes first.
+ // Older build completion goes first.
+ //
+ // Note that a completed build can have the state change timestamp
+ // (timestamp member) newer than the completion timestamp
+ // (soft_timestamp member) if the build was interrupted.
+ //
+ return x->soft_timestamp < y->soft_timestamp;
};
sort (rebuilds.begin (), rebuilds.end (), cmp);