removed the defer idiom for storing audit records; it's not necessary, because AmStoreAudit just pushes the audit record to the writer goroutine anyway

This commit is contained in:
2026-02-21 18:24:29 -07:00
parent 5acb67106c
commit f48d97868d
5 changed files with 45 additions and 125 deletions
+2 -6
View File
@@ -854,10 +854,6 @@ func AmSetCommunityProperty(ctx context.Context, cid int32, ndx int32, val *stri
*/
func AmCreateCommunity(ctx context.Context, name string, alias string, hostUid int32, language *string, synopsis *string,
rules *string, joinkey *string, hideDirectory bool, hideSearch bool, remoteIP string) (*Community, error) {
var ar *AuditRecord = nil
defer func() {
AmStoreAudit(ar)
}()
success := false
tx := amdb.MustBegin()
defer func() {
@@ -917,8 +913,8 @@ func AmCreateCommunity(ctx context.Context, name string, alias string, hostUid i
success = true
// operation was a success - add an audit record
ar = AmNewCommAudit(AuditCommunityCreate, hostUid, comm.Id, remoteIP, fmt.Sprintf("id=%d", comm.Id),
fmt.Sprintf("name=%s", comm.Name), fmt.Sprintf("alias=%s", comm.Alias))
AmStoreAudit(AmNewCommAudit(AuditCommunityCreate, hostUid, comm.Id, remoteIP, fmt.Sprintf("id=%d", comm.Id),
fmt.Sprintf("name=%s", comm.Name), fmt.Sprintf("alias=%s", comm.Alias)))
return comm, nil
}