Skip to content

Commit

Permalink
Stop spurious APIFormat stopwatches logs (go-gitea#20008)
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
zeripath authored and Sysoev, Vladimir committed Aug 10, 2022
1 parent 5c9363e commit 9962d75
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
4 changes: 3 additions & 1 deletion modules/eventsource/manager_run.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
4 changes: 3 additions & 1 deletion routers/web/repo/issue_stopwatch.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down

0 comments on commit 9962d75

Please sign in to comment.