diff --git a/image/app/common/compare.go b/image/app/common/compare.go index 8a8050a..1ec5547 100644 --- a/image/app/common/compare.go +++ b/image/app/common/compare.go @@ -108,6 +108,13 @@ func Compare(w http.ResponseWriter, r *http.Request) { return } + errMessage := config.GetRedis().Get(r.Context(), fmt.Sprintf("error %v", req.PersistentId)) + if errMessage != nil && errMessage.Val() != "" { + w.WriteHeader(http.StatusInternalServerError) + w.Write([]byte(fmt.Sprintf("Job failed: %v", errMessage))) + return + } + //map nodes nm := map[string]tree.Node{} for _, v := range req.Data { diff --git a/image/app/core/persisting.go b/image/app/core/persisting.go index 7d330c9..674ba36 100644 --- a/image/app/core/persisting.go +++ b/image/app/core/persisting.go @@ -57,6 +57,7 @@ func sendJobFailedMail(ctx context.Context, errIn error, job Job) error { msg := fmt.Sprintf("To: %v\r\nMIME-version: 1.0;\r\nContent-Type: text/html; charset=\"UTF-8\";\r\nSubject: %v"+ "\r\n\r\n%v\r\n", to, getSubjectOnError(errIn, job), getContentOnError(errIn, job)) err = SendMail(msg, []string{to}) + config.GetRedis().Set(ctx, fmt.Sprintf("error %v", job.PersistentId), err.Error(), FileNamesInCacheDuration) if err != nil { return fmt.Errorf("error when sending email on error (%v): %v", errIn, err) } @@ -230,6 +231,7 @@ func doPersistNodeMap(ctx context.Context, streams map[string]types.Stream, in J err = ctx.Err() return default: + writtenKeys = append(writtenKeys, fmt.Sprintf("error %v", in.PersistentId)) err = cleanup(ctx, in.DataverseKey, in.User, in.PersistentId, writtenKeys) } return