mirror of
https://github.com/documize/community.git
synced 2025-07-24 15:49:44 +02:00
Fix order of DB transaction commits
Some DB commit commands were out of sequence and so have been fixed to be consist across the board. Specially, audit log entries have their own DB TX and so should be executed outside of any other commit cycle.
This commit is contained in:
parent
880f39f1cb
commit
0997655e0a
16 changed files with 100 additions and 75 deletions
|
@ -155,10 +155,10 @@ func (h *Handler) Delete(w http.ResponseWriter, r *http.Request) {
|
|||
return
|
||||
}
|
||||
|
||||
h.Store.Audit.Record(ctx, audit.EventTypeAttachmentDelete)
|
||||
|
||||
ctx.Transaction.Commit()
|
||||
|
||||
h.Store.Audit.Record(ctx, audit.EventTypeAttachmentDelete)
|
||||
|
||||
a, _ := h.Store.Attachment.GetAttachments(ctx, documentID)
|
||||
d, _ := h.Store.Document.Get(ctx, documentID)
|
||||
go h.Indexer.IndexDocument(ctx, d, a)
|
||||
|
@ -230,10 +230,10 @@ func (h *Handler) Add(w http.ResponseWriter, r *http.Request) {
|
|||
return
|
||||
}
|
||||
|
||||
h.Store.Audit.Record(ctx, audit.EventTypeAttachmentAdd)
|
||||
|
||||
ctx.Transaction.Commit()
|
||||
|
||||
h.Store.Audit.Record(ctx, audit.EventTypeAttachmentAdd)
|
||||
|
||||
all, _ := h.Store.Attachment.GetAttachments(ctx, documentID)
|
||||
d, _ := h.Store.Document.Get(ctx, documentID)
|
||||
go h.Indexer.IndexDocument(ctx, d, all)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue