Skip to content

Commit ae446b1

Browse files
authored
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 <[email protected]>
1 parent 5d80feb commit ae446b1

File tree

2 files changed

+6
-2
lines changed

2 files changed

+6
-2
lines changed

modules/eventsource/manager_run.go

+3-1
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,9 @@ loop:
9494
for _, userStopwatches := range usersStopwatches {
9595
apiSWs, err := convert.ToStopWatches(userStopwatches.StopWatches)
9696
if err != nil {
97-
log.Error("Unable to APIFormat stopwatches: %v", err)
97+
if !issues_model.IsErrIssueNotExist(err) {
98+
log.Error("Unable to APIFormat stopwatches: %v", err)
99+
}
98100
continue
99101
}
100102
dataBs, err := json.Marshal(apiSWs)

routers/web/repo/issue_stopwatch.go

+3-1
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,9 @@ func GetActiveStopwatch(ctx *context.Context) {
9999

100100
issue, err := issues_model.GetIssueByID(ctx, sw.IssueID)
101101
if err != nil || issue == nil {
102-
ctx.ServerError("GetIssueByID", err)
102+
if !issues_model.IsErrIssueNotExist(err) {
103+
ctx.ServerError("GetIssueByID", err)
104+
}
103105
return
104106
}
105107
if err = issue.LoadRepo(ctx); err != nil {

0 commit comments

Comments
 (0)