mirror of
https://github.com/mjl-/mox.git
synced 2025-07-13 21:34:37 +03:00
After queueing a message in the web api's, prevent context cancelation from completing message changes
Adding to the queue is done in a transaction, the queue db file is mox-global. Appending the message to the Sent folder, removing it from Drafts, marking the original message as answered/forwarded, is done in a separate database transaction that gets the ctx passed in. If the ctx was canceled in between, the queueing was finished, but the rest wasn't completed. Reported by mteege, thanks!
This commit is contained in:
@ -1048,6 +1048,9 @@ func (s server) Send(ctx context.Context, req webapi.SendRequest) (resp webapi.S
|
||||
xcheckf(err, "adding messages to the delivery queue")
|
||||
metricSubmission.WithLabelValues("ok").Inc()
|
||||
|
||||
// Message has been added to the queue. Ensure we finish the work.
|
||||
ctx = context.WithoutCancel(ctx)
|
||||
|
||||
if req.SaveSent {
|
||||
// Append message to Sent mailbox and mark original messages as answered/forwarded.
|
||||
acc.WithRLock(func() {
|
||||
|
Reference in New Issue
Block a user