Skip to content

Commit 9cff344

Browse files
committed
only check filter once on export
1 parent a60c1f7 commit 9cff344

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

coderd/audit/exporter.go

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -34,11 +34,12 @@ func NewExporter(filter Filter, backends ...Backend) *Exporter {
3434
// filter to determine if the backend tolerates the audit log. If not, it is
3535
// dropped.
3636
func (e *Exporter) Export(ctx context.Context, alog database.AuditLog) error {
37+
decision, err := e.filter.Check(ctx, alog)
38+
if err != nil {
39+
return xerrors.Errorf("filter check: %w", err)
40+
}
41+
3742
for _, backend := range e.backends {
38-
decision, err := e.filter.Check(ctx, alog)
39-
if err != nil {
40-
return xerrors.Errorf("filter check: %w", err)
41-
}
4243

4344
if decision&backend.Decision() != backend.Decision() {
4445
continue

0 commit comments

Comments
 (0)