shutdownBatch makes a single write attempt during shutdown with a bounded timeout so it can't hang indefinitely.
(params database.BatchUpsertConnectionLogsParams)
| 498 | // shutdownBatch makes a single write attempt during shutdown with a |
| 499 | // bounded timeout so it can't hang indefinitely. |
| 500 | func (b *DBBatcher) shutdownBatch(params database.BatchUpsertConnectionLogsParams) { |
| 501 | ctx, cancel := context.WithTimeout(context.Background(), shutdownWriteTimeout) |
| 502 | defer cancel() |
| 503 | //nolint:gocritic // System-level batch operation for connection logs. |
| 504 | err := b.store.BatchUpsertConnectionLogs(dbauthz.AsConnectionLogger(ctx), params) |
| 505 | if err != nil { |
| 506 | b.log.Error(b.ctx, "batch write failed on shutdown, dropping batch", |
| 507 | slog.Error(err), slog.F("dropped", len(params.ID))) |
| 508 | } |
| 509 | } |
| 510 | |
| 511 | type connectionSlogBackend struct { |
| 512 | exporter *auditbackends.SlogExporter |
no test coverage detected