lazydebug evaluates args only if debug log is enabled. It is used to avoid unnecessary allocations when logging is disabled. Queue MUST remain fast and not allocate memory when logging is disabled.
(msg string, argsFn func() []any)
| 748 | // It is used to avoid unnecessary allocations when logging is disabled. |
| 749 | // Queue MUST remain fast and not allocate memory when logging is disabled. |
| 750 | func (q *TaskQueue) lazydebug(msg string, argsFn func() []any) { |
| 751 | if q.logger != nil && q.logger.Enabled(context.Background(), slog.LevelDebug) { |
| 752 | q.logger.Debug(msg, argsFn()...) |
| 753 | } |
| 754 | } |
| 755 | |
| 756 | func (q *TaskQueue) Start(ctx context.Context) { |
| 757 | if q.started.Load() { |
no outgoing calls
no test coverage detected