Stop spurious APIFormat stopwatches logs (#20008)
If there are dangling stopwatches with missing issues there will be repeated logging of Unable to APIFormat stopwatches. These are unhelpful and instead we should only log if the error is not an issue not exist error. And we should also prevent an error on missing issue in GetActiveStopwatch too Signed-off-by: Andrew Thornton <art27@cantab.net>
This commit is contained in:
parent
5d80feb5a6
commit
ae446b13f9
2 changed files with 6 additions and 2 deletions
|
@ -94,7 +94,9 @@ loop:
|
|||
for _, userStopwatches := range usersStopwatches {
|
||||
apiSWs, err := convert.ToStopWatches(userStopwatches.StopWatches)
|
||||
if err != nil {
|
||||
if !issues_model.IsErrIssueNotExist(err) {
|
||||
log.Error("Unable to APIFormat stopwatches: %v", err)
|
||||
}
|
||||
continue
|
||||
}
|
||||
dataBs, err := json.Marshal(apiSWs)
|
||||
|
|
|
@ -99,7 +99,9 @@ func GetActiveStopwatch(ctx *context.Context) {
|
|||
|
||||
issue, err := issues_model.GetIssueByID(ctx, sw.IssueID)
|
||||
if err != nil || issue == nil {
|
||||
if !issues_model.IsErrIssueNotExist(err) {
|
||||
ctx.ServerError("GetIssueByID", err)
|
||||
}
|
||||
return
|
||||
}
|
||||
if err = issue.LoadRepo(ctx); err != nil {
|
||||
|
|
Reference in a new issue