diff --git a/pkg/captcha/db.go b/pkg/captcha/db.go index c58da36..e8963b4 100644 --- a/pkg/captcha/db.go +++ b/pkg/captcha/db.go @@ -55,6 +55,8 @@ func (cdb *CaptchaDB) SetExpiry(expire time.Duration) { for id, captcha := range cdb.DB { if time.Now().Sub(captcha.Expiry()) <= 0 { + cdb.Lock() + defer cdb.Unlock() delete(cdb.DB, id) } }