mirror of
				https://github.com/go-gitea/gitea
				synced 2025-10-31 11:28:24 +00:00 
			
		
		
		
	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:
		| @@ -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 { | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user