aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorzeripath2022-06-17 22:47:15 +0100
committerGitHub2022-06-17 22:47:15 +0100
commitae446b13f938948c3f9305635621f3af11a5c04c (patch)
treebd67f473052576a469738592b87b4a7133bb8dc7
parent5d80feb5a6afebd313ed3c17d45920adfadb6af4 (diff)
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>
-rw-r--r--modules/eventsource/manager_run.go4
-rw-r--r--routers/web/repo/issue_stopwatch.go4
2 files changed, 6 insertions, 2 deletions
diff --git a/modules/eventsource/manager_run.go b/modules/eventsource/manager_run.go
index 6055cf723..06d48454f 100644
--- a/modules/eventsource/manager_run.go
+++ b/modules/eventsource/manager_run.go
@@ -94,7 +94,9 @@ loop:
for _, userStopwatches := range usersStopwatches {
apiSWs, err := convert.ToStopWatches(userStopwatches.StopWatches)
if err != nil {
- log.Error("Unable to APIFormat stopwatches: %v", err)
+ if !issues_model.IsErrIssueNotExist(err) {
+ log.Error("Unable to APIFormat stopwatches: %v", err)
+ }
continue
}
dataBs, err := json.Marshal(apiSWs)
diff --git a/routers/web/repo/issue_stopwatch.go b/routers/web/repo/issue_stopwatch.go
index 68f89b258..97d4441a2 100644
--- a/routers/web/repo/issue_stopwatch.go
+++ b/routers/web/repo/issue_stopwatch.go
@@ -99,7 +99,9 @@ func GetActiveStopwatch(ctx *context.Context) {
issue, err := issues_model.GetIssueByID(ctx, sw.IssueID)
if err != nil || issue == nil {
- ctx.ServerError("GetIssueByID", err)
+ if !issues_model.IsErrIssueNotExist(err) {
+ ctx.ServerError("GetIssueByID", err)
+ }
return
}
if err = issue.LoadRepo(ctx); err != nil {