mirror of
https://github.com/documize/community.git
synced 2025-08-04 13:05:23 +02:00
Optimize space deletion process
Utilize multiple SQL transactions to close out the space deletion process.
This commit is contained in:
parent
d05052a5b4
commit
d281621d90
5 changed files with 804 additions and 795 deletions
|
@ -248,6 +248,12 @@ func processDocument(ctx domain.RequestContext, r *env.Runtime, store *store.Sto
|
|||
SourceType: activity.SourceTypeDocument,
|
||||
ActivityType: activity.TypeCreated})
|
||||
|
||||
err = store.Space.IncrementContentCount(ctx, newDocument.SpaceID)
|
||||
if err != nil {
|
||||
err = errors.Wrap(err, "cannot increment space content count")
|
||||
return
|
||||
}
|
||||
|
||||
err = ctx.Transaction.Commit()
|
||||
if err != nil {
|
||||
err = errors.Wrap(err, "cannot commit new document import")
|
||||
|
@ -262,12 +268,6 @@ func processDocument(ctx domain.RequestContext, r *env.Runtime, store *store.Sto
|
|||
|
||||
go indexer.IndexDocument(ctx, newDocument, da)
|
||||
|
||||
err = store.Space.IncrementContentCount(ctx, newDocument.SpaceID)
|
||||
if err != nil {
|
||||
err = errors.Wrap(err, "cannot increment space content count")
|
||||
return
|
||||
}
|
||||
|
||||
store.Audit.Record(ctx, audit.EventTypeDocumentUpload)
|
||||
|
||||
return
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue