Skip to content

Commit 54e8146

Browse files
committed
handlers/email: Fix mutex issue
1 parent a9d6e7b commit 54e8146

File tree

1 file changed

+5
-6
lines changed

1 file changed

+5
-6
lines changed

handlers/email/email.go

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -168,26 +168,25 @@ func (email *Email) Log(e log.Entry) {
168168
email.rw.RLock()
169169

170170
if !email.enabled {
171+
email.rw.RUnlock()
171172
return
172173
}
173174

174-
email.rw.RUnlock()
175-
176175
email.once.Do(func() {
177176
email.formatter = email.formatFunc(email)
178177
})
179178

179+
d := gomail.NewDialer(email.host, email.port, email.username, email.password)
180+
181+
email.rw.RUnlock()
182+
180183
var s gomail.SendCloser
181184
var err error
182185
var open bool
183186
var alreadyTriedSending bool
184187
var message *gomail.Message
185188
var count uint8
186189

187-
email.rw.RLock()
188-
d := gomail.NewDialer(email.host, email.port, email.username, email.password)
189-
email.rw.RUnlock()
190-
191190
for {
192191
count = 0
193192
alreadyTriedSending = false

0 commit comments

Comments
 (0)