diff options
| -rw-r--r-- | CHANGELOG.md | 3 | ||||
| -rw-r--r-- | walrss/internal/http/testEmail.go | 5 |
2 files changed, 7 insertions, 1 deletions
diff --git a/CHANGELOG.md b/CHANGELOG.md index 6f6ea0c..d31922c 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,6 +5,9 @@ All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). ## Unreleased +### Fixed +* Remove potential race condition caused by using `RLock` instead of `Lock` + ## 0.3.6 - 2023-02-25 ### Changed * Updated Go build version diff --git a/walrss/internal/http/testEmail.go b/walrss/internal/http/testEmail.go index 5070cbf..86c3e60 100644 --- a/walrss/internal/http/testEmail.go +++ b/walrss/internal/http/testEmail.go @@ -66,11 +66,14 @@ func (s *Server) testEmailStatus(ctx *fiber.Ctx) error { testEmailStatesLock.RLock() var content string if end { + testEmailStatesLock.RUnlock() + testEmailStatesLock.Lock() delete(testEmailStates, currentUserID) + testEmailStatesLock.Unlock() } else { content = testEmailStates[currentUserID] + testEmailStatesLock.RUnlock() } - defer testEmailStatesLock.RUnlock() if end { ctx.Set("HX-Refresh", "true") |
