mirror of
https://codeberg.org/forgejo/forgejo.git
synced 2024-09-11 04:30:06 +02:00
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 {
|
||||
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)
|
||||
|
|
|
@ -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 {
|
||||
|
|
Loading…
Reference in a new issue