diff options
Diffstat (limited to 'mod/mod-build-result.cxx')
-rw-r--r-- | mod/mod-build-result.cxx | 24 |
1 files changed, 17 insertions, 7 deletions
diff --git a/mod/mod-build-result.cxx b/mod/mod-build-result.cxx index 666e7ef..38f13a6 100644 --- a/mod/mod-build-result.cxx +++ b/mod/mod-build-result.cxx @@ -3,6 +3,8 @@ #include <mod/mod-build-result.hxx> +#include <chrono> + #include <odb/database.hxx> #include <odb/transaction.hxx> @@ -354,10 +356,10 @@ handle (request& rq, response&) // If we ought to call the tenant_service_build_queued::build_queued() // callback, then also set the package tenant's queued timestamp to - // the current time to prevent the task handler from picking the build - // and potentially interfering with us by sending its `building` - // notification before we send our `queued` notification (see - // tenant::queued_timestamp for details). + // prevent the task handler from picking the build and potentially + // interfering with us by sending its `building` notification before + // we send our `queued` notification (see tenant::queued_timestamp for + // details). // if (tsq != nullptr) { @@ -375,10 +377,18 @@ handle (request& rq, response&) qhs = tenant_service_build_queued::build_queued_hints { tpc == 1, p->configs.size () == 1}; - // Set the package tenant's queued timestamp. + // Set the package tenant's queued timestamp, unless it is already + // set to the same or greater value. // - t->queued_timestamp = system_clock::now (); - build_db_->update (t); + timestamp ts ( + system_clock::now () + + chrono::seconds (options_->build_queued_timeout ())); + + if (!t->queued_timestamp || *t->queued_timestamp < ts) + { + t->queued_timestamp = ts; + build_db_->update (t); + } } } else // Regular or skip build result. |