Skip to content

Commit fa9d839

Browse files
Passes cancellation token to context factory
Ensures cancellation token is passed when creating a pipeline context, allowing for proper cancellation of asynchronous operations within the pipeline.
1 parent b8f305c commit fa9d839

File tree

4 files changed

+5
-5
lines changed

4 files changed

+5
-5
lines changed

src/Hyperbee.Pipeline/Commands/CommandFunction.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ protected CommandFunction( IPipelineContextFactory pipelineContextFactory, ILogg
2222

2323
public virtual async Task<CommandResult<TOutput>> ExecuteAsync( TStart argument, CancellationToken cancellation = default )
2424
{
25-
var context = ContextFactory.Create( Logger );
25+
var context = ContextFactory.Create( Logger, cancellation );
2626

2727
return new CommandResult<TOutput>
2828
{

src/Hyperbee.Pipeline/Commands/CommandProcedure.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ protected CommandProcedure( IPipelineContextFactory pipelineContextFactory, ILog
2222

2323
public virtual async Task<CommandResult> ExecuteAsync( TStart argument, CancellationToken cancellation = default )
2424
{
25-
var context = ContextFactory.Create( Logger );
25+
var context = ContextFactory.Create( Logger, cancellation );
2626

2727
await Pipeline.Value( context, argument ).ConfigureAwait( false );
2828

src/Hyperbee.Pipeline/Context/IPipelineContextFactory.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,5 +4,5 @@ namespace Hyperbee.Pipeline.Context;
44

55
public interface IPipelineContextFactory
66
{
7-
IPipelineContext Create( ILogger logger );
7+
IPipelineContext Create( ILogger logger, CancellationToken cancellation = default );
88
}

src/Hyperbee.Pipeline/Context/PipelineContextFactory.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,9 +15,9 @@ private PipelineContextFactory( IServiceProvider serviceProvider )
1515
_serviceProvider = serviceProvider;
1616
}
1717

18-
public IPipelineContext Create( ILogger logger )
18+
public IPipelineContext Create( ILogger logger, CancellationToken cancellation = default )
1919
{
20-
return new PipelineContext
20+
return new PipelineContext( cancellation )
2121
{
2222
Logger = logger,
2323
ServiceProvider = _serviceProvider

0 commit comments

Comments
 (0)