Skip to content

Commit

Permalink
add node.deactivated event
Browse files Browse the repository at this point in the history
  • Loading branch information
ezekg committed Dec 16, 2024
1 parent 3a726eb commit 599d8be
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions internal/licenses/manager.go
Original file line number Diff line number Diff line change
Expand Up @@ -319,8 +319,11 @@ func (m *manager) ReleaseLicense(ctx context.Context, fingerprint string) (*Lice
}

if m.config.EnabledAudit {
if err := m.store.InsertAuditLog(ctx, db.EventTypeLicenseReleased, db.EntityTypeLicense, claimedLicense.ID); err != nil {
slog.Warn("failed to insert audit log", "licenseID", claimedLicense.ID, "error", err)
if err := m.store.BulkInsertAuditLogs(ctx, []db.BulkInsertAuditLogParams{
{EventTypeID: db.EventTypeLicenseReleased, EntityTypeID: db.EntityTypeLicense, EntityID: claimedLicense.ID},
{EventTypeID: db.EventTypeNodeDeactivated, EntityTypeID: db.EntityTypeNode, EntityID: node.Fingerprint},
}); err != nil {
slog.Warn("failed to insert audit logs", "error", err)
}
}

Expand Down

0 comments on commit 599d8be

Please sign in to comment.