mirror of
https://codeberg.org/Codeberg/pages-server.git
synced 2024-11-18 10:29:43 +00:00
Fix iterator issue causing 100% CPU load
This commit is contained in:
parent
ce802734d4
commit
e5385be6da
1 changed files with 3 additions and 2 deletions
|
@ -443,7 +443,8 @@ func setupCertificates() {
|
|||
// clean up expired certs
|
||||
now := time.Now()
|
||||
expiredCertCount := 0
|
||||
key, resBytes, err := keyDatabase.Items().Next()
|
||||
keyDatabaseIterator := keyDatabase.Items()
|
||||
key, resBytes, err := keyDatabaseIterator.Next()
|
||||
for err == nil {
|
||||
if !bytes.Equal(key, MainDomainSuffix) {
|
||||
resGob := bytes.NewBuffer(resBytes)
|
||||
|
@ -464,7 +465,7 @@ func setupCertificates() {
|
|||
}
|
||||
}
|
||||
}
|
||||
key, resBytes, err = keyDatabase.Items().Next()
|
||||
key, resBytes, err = keyDatabaseIterator.Next()
|
||||
}
|
||||
log.Printf("Removed %d expired certificates from the database", expiredCertCount)
|
||||
|
||||
|
|
Loading…
Reference in a new issue