Skip to content

Commit 9594fc9

Browse files
committed
chore(redis): tidy diagnostic logs for blocked projects
1 parent f41e208 commit 9594fc9

1 file changed

Lines changed: 17 additions & 3 deletions

File tree

pkg/redis/client.go

Lines changed: 17 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -115,17 +115,31 @@ func (r *RedisClient) load() error {
115115

116116
prevCount := len(r.blockedIDs)
117117
if len(keys) != prevCount {
118-
log.Infof("Banned projects list updated %d -> %d (key=%q, scard=%d)", prevCount, len(keys), r.blockedIDsSetName, cardinality)
118+
if cardErr == nil {
119+
log.Infof("Banned projects list updated %d -> %d (key=%q, scard=%d)", prevCount, len(keys), r.blockedIDsSetName, cardinality)
120+
} else {
121+
log.Infof("Banned projects list updated %d -> %d (key=%q, scard_err=%q)", prevCount, len(keys), r.blockedIDsSetName, cardErr)
122+
}
119123
}
120124
if cardErr == nil && int64(len(keys)) != cardinality {
121125
log.Warnf("SScan returned %d entries but SCARD reports %d for key %q — set may be larger than one SScan batch", len(keys), cardinality, r.blockedIDsSetName)
122126
}
123127
if len(keys) == 0 && prevCount > 0 {
124128
log.Warnf("Blocked projects list is now empty (was %d). Key %q may have been cleared", prevCount, r.blockedIDsSetName)
125129
}
126-
log.Debugf("Loaded blocked project IDs from %q (count=%d): %v", r.blockedIDsSetName, len(keys), keys)
127-
r.blockedIDs = keys
128130

131+
const sampleSize = 5
132+
if len(keys) == 0 {
133+
log.Debugf("Loaded blocked project IDs from %q (count=0)", r.blockedIDsSetName)
134+
} else {
135+
sample := keys
136+
if len(sample) > sampleSize {
137+
sample = sample[:sampleSize]
138+
}
139+
log.Debugf("Loaded blocked project IDs from %q (count=%d, sample=%v)", r.blockedIDsSetName, len(keys), sample)
140+
}
141+
142+
r.blockedIDs = keys
129143
return nil
130144
}
131145

0 commit comments

Comments
 (0)