Skip to content

Commit bac65f1

Browse files
zeripathtechknowlogickhollie
authored
Fix incorrect error logging in Stats indexer and OAuth2 (#12387)
* Fix incorrect logging in oauth2.go Fix #11945 Signed-off-by: Andrew Thornton <[email protected]> * Handle ErrAlreadyInQueue in stats indexer Fix #12380 Signed-off-by: Andrew Thornton <[email protected]> * Fixes type in error message of indexer Add the missing character in the error message. Co-authored-by: techknowlogick <[email protected]> Co-authored-by: Lieven Hollevoet <[email protected]>
1 parent b3e0652 commit bac65f1

File tree

2 files changed

+9
-3
lines changed

2 files changed

+9
-3
lines changed

modules/auth/sso/oauth2.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,7 @@ func (o *OAuth2) userIDFromToken(ctx *macaron.Context) int64 {
9393
}
9494
t, err := models.GetAccessTokenBySHA(tokenSHA)
9595
if err != nil {
96-
if models.IsErrAccessTokenNotExist(err) || models.IsErrAccessTokenEmpty(err) {
96+
if !models.IsErrAccessTokenNotExist(err) && !models.IsErrAccessTokenEmpty(err) {
9797
log.Error("GetAccessTokenBySHA: %v", err)
9898
}
9999
return 0

modules/indexer/stats/queue.go

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ func handle(data ...queue.Data) {
2121
for _, datum := range data {
2222
opts := datum.(int64)
2323
if err := indexer.Index(opts); err != nil {
24-
log.Error("stats queue idexer.Index(%d) failed: %v", opts, err)
24+
log.Error("stats queue indexer.Index(%d) failed: %v", opts, err)
2525
}
2626
}
2727
}
@@ -39,5 +39,11 @@ func initStatsQueue() error {
3939

4040
// UpdateRepoIndexer update a repository's entries in the indexer
4141
func UpdateRepoIndexer(repo *models.Repository) error {
42-
return statsQueue.Push(repo.ID)
42+
if err := statsQueue.Push(repo.ID); err != nil {
43+
if err != queue.ErrAlreadyInQueue {
44+
return err
45+
}
46+
log.Debug("Repo ID: %d already queued", repo.ID)
47+
}
48+
return nil
4349
}

0 commit comments

Comments
 (0)