cloudapi/v2: Hard timeout for manifest job
This commit is contained in:
parent
028eca1b26
commit
0a49dbe560
1 changed files with 9 additions and 1 deletions
|
|
@ -378,9 +378,11 @@ func (h *apiHandlers) PostCompose(ctx echo.Context) error {
|
|||
}
|
||||
|
||||
ctx.Logger().Infof("Job ID %s enqueued for operationID %s", id, ctx.Get("operationID"))
|
||||
manifestJobContext, manifestCancel := context.WithTimeout(context.Background(), time.Minute*5)
|
||||
|
||||
// start 1 goroutine which requests datajob type
|
||||
go func(workers *worker.Server, manifestJobID uuid.UUID, b *blueprint.Customizations, options distro.ImageOptions, repos []rpmmd.RepoConfig, seed int64) {
|
||||
defer manifestCancel()
|
||||
// wait until job is in a pending state
|
||||
var token uuid.UUID
|
||||
var dynArgs []json.RawMessage
|
||||
|
|
@ -390,7 +392,13 @@ func (h *apiHandlers) PostCompose(ctx echo.Context) error {
|
|||
if err == jobqueue.ErrNotPending {
|
||||
logrus.Debugf("Manifest job %v not pending, waiting for depsolve job to finish", manifestJobID)
|
||||
time.Sleep(time.Millisecond * 50)
|
||||
continue
|
||||
select {
|
||||
case <-manifestJobContext.Done():
|
||||
logrus.Warnf("Manifest job %v's dependencies took longer than 5 minutes to finish, returning to avoid dangling routines", manifestJobID)
|
||||
return
|
||||
default:
|
||||
continue
|
||||
}
|
||||
}
|
||||
if err != nil {
|
||||
logrus.Errorf("Error requesting manifest job: %v", err)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue