Only return valid stopwatches (#19863)
Looking through the logs of try.gitea.io I am seeing a number of reports of being unable to APIformat stopwatches because the issueID is 0. These are invalid StopWatches and they represent a db inconsistency. This PR simply stops sending them to the eventsource. Signed-off-by: Andrew Thornton <art27@cantab.net> Co-authored-by: techknowlogick <techknowlogick@gitea.io>
This commit is contained in:
parent
5283d1ead5
commit
8aaba65eee
1 changed files with 1 additions and 1 deletions
|
@ -75,7 +75,7 @@ type UserStopwatch struct {
|
||||||
// GetUIDsAndNotificationCounts between the two provided times
|
// GetUIDsAndNotificationCounts between the two provided times
|
||||||
func GetUIDsAndStopwatch() ([]*UserStopwatch, error) {
|
func GetUIDsAndStopwatch() ([]*UserStopwatch, error) {
|
||||||
sws := []*Stopwatch{}
|
sws := []*Stopwatch{}
|
||||||
if err := db.GetEngine(db.DefaultContext).Find(&sws); err != nil {
|
if err := db.GetEngine(db.DefaultContext).Where("issue_id != 0").Find(&sws); err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
if len(sws) == 0 {
|
if len(sws) == 0 {
|
||||||
|
|
Loading…
Reference in a new issue