Class FireAndForgetRunner
Default implementation of IFireAndForgetRunner that runs tasks on background threads.
Inheritance
object
Namespace: Umbraco.Cms.Core
Assembly: Umbraco.Core.dll
Syntax
public class FireAndForgetRunner : IFireAndForgetRunner
Remarks
This implementation suppresses the execution context flow to prevent AsyncLocal values from leaking to child threads.
Constructors
View SourceFireAndForgetRunner(ILogger<FireAndForgetRunner>)
Initializes a new instance of the FireAndForgetRunner class.
Declaration
public FireAndForgetRunner(ILogger<FireAndForgetRunner> logger)
Parameters
| Type | Name | Description |
|---|---|---|
| ILogger<FireAndForgetRunner> | logger | The logger for recording exceptions from background tasks. |
Methods
View SourceRunFireAndForget(Func<Task>)
Runs the specified task in the background without waiting for it to complete.
Declaration
public void RunFireAndForget(Func<Task> task)
Parameters
| Type | Name | Description |
|---|---|---|
| Func<Task> | task | A function that returns the task to execute. |
Remarks
The task will be executed on a background thread. Exceptions will be logged but not propagated to the caller.