mirror of
https://github.com/mjl-/mox.git
synced 2024-12-27 08:53:48 +03:00
webmail: single db transaction while fetching parsed message
This commit is contained in:
parent
8ad32f9ede
commit
ed0c520562
1 changed files with 8 additions and 12 deletions
|
@ -169,23 +169,19 @@ func (Webmail) ParsedMessage(ctx context.Context, msgID int64) (pm ParsedMessage
|
||||||
log.Check(err, "closing account")
|
log.Check(err, "closing account")
|
||||||
}()
|
}()
|
||||||
|
|
||||||
var m store.Message
|
|
||||||
xdbread(ctx, acc, func(tx *bstore.Tx) {
|
xdbread(ctx, acc, func(tx *bstore.Tx) {
|
||||||
m = xmessageID(ctx, tx, msgID)
|
m := xmessageID(ctx, tx, msgID)
|
||||||
})
|
|
||||||
|
|
||||||
state := msgState{acc: acc}
|
state := msgState{acc: acc}
|
||||||
defer state.clear()
|
defer state.clear()
|
||||||
pm, err = parsedMessage(log, m, &state, true, false)
|
pm, err = parsedMessage(log, m, &state, true, false)
|
||||||
xcheckf(ctx, err, "parsing message")
|
xcheckf(ctx, err, "parsing message")
|
||||||
|
|
||||||
if len(pm.envelope.From) == 1 {
|
if len(pm.envelope.From) == 1 {
|
||||||
xdbread(ctx, acc, func(tx *bstore.Tx) {
|
|
||||||
pm.ViewMode, err = fromAddrViewMode(tx, pm.envelope.From[0])
|
pm.ViewMode, err = fromAddrViewMode(tx, pm.envelope.From[0])
|
||||||
xcheckf(ctx, err, "looking up view mode for from address")
|
xcheckf(ctx, err, "looking up view mode for from address")
|
||||||
})
|
}
|
||||||
}
|
})
|
||||||
|
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue