@@ -93,7 +93,7 @@ protected internal async Task HandleRpcMessage(Message msg, CancellationToken ca
93
93
{
94
94
var activity = this . ExtractActivity ( msg . CloudEvent . Type , msg . CloudEvent . Metadata ) ;
95
95
await this . InvokeWithActivityAsync (
96
- static ( ( AgentBase Agent , CloudEvent Item ) state ) => state . Agent . CallHandler ( state . Item ) ,
96
+ static ( ( AgentBase Agent , CloudEvent Item ) state , CancellationToken _ ) => state . Agent . CallHandler ( state . Item ) ,
97
97
( this , msg . CloudEvent ) ,
98
98
activity ,
99
99
msg . CloudEvent . Type , cancellationToken ) . ConfigureAwait ( false ) ;
@@ -103,7 +103,7 @@ await this.InvokeWithActivityAsync(
103
103
{
104
104
var activity = this . ExtractActivity ( msg . Request . Method , msg . Request . Metadata ) ;
105
105
await this . InvokeWithActivityAsync (
106
- static ( ( AgentBase Agent , RpcRequest Request ) state ) => state . Agent . OnRequestCoreAsync ( state . Request ) ,
106
+ static ( ( AgentBase Agent , RpcRequest Request ) state , CancellationToken ct ) => state . Agent . OnRequestCoreAsync ( state . Request , ct ) ,
107
107
( this , msg . Request ) ,
108
108
activity ,
109
109
msg . Request . Method , cancellationToken ) . ConfigureAwait ( false ) ;
@@ -142,8 +142,8 @@ public async Task StoreAsync(AgentState state, CancellationToken cancellationTok
142
142
}
143
143
public async Task < T > ReadAsync < T > ( AgentId agentId , CancellationToken cancellationToken = default ) where T : IMessage , new ( )
144
144
{
145
- var agentstate = await _context . ReadAsync ( agentId , cancellationToken ) . ConfigureAwait ( false ) ;
146
- return agentstate . FromAgentState < T > ( ) ;
145
+ var agentState = await _context . ReadAsync ( agentId , cancellationToken ) . ConfigureAwait ( false ) ;
146
+ return agentState . FromAgentState < T > ( ) ;
147
147
}
148
148
private void OnResponseCore ( RpcResponse response )
149
149
{
@@ -195,9 +195,9 @@ protected async Task<RpcResponse> RequestAsync(AgentId target, string method, Di
195
195
activity ? . SetTag ( "peer.service" , target . ToString ( ) ) ;
196
196
197
197
var completion = new TaskCompletionSource < RpcResponse > ( TaskCreationOptions . RunContinuationsAsynchronously ) ;
198
- _context . Update ( activity , request ) ;
198
+ _context . Update ( request , activity ) ;
199
199
await this . InvokeWithActivityAsync (
200
- static async ( ( AgentBase Agent , RpcRequest Request , TaskCompletionSource < RpcResponse > ) state ) =>
200
+ static async ( ( AgentBase Agent , RpcRequest Request , TaskCompletionSource < RpcResponse > ) state , CancellationToken ct ) =>
201
201
{
202
202
var ( self , request , completion ) = state ;
203
203
@@ -206,7 +206,7 @@ static async ((AgentBase Agent, RpcRequest Request, TaskCompletionSource<RpcResp
206
206
self . _pendingRequests [ request . RequestId ] = completion ;
207
207
}
208
208
209
- await state . Agent . _context . SendRequestAsync ( state . Agent , state . Request ) . ConfigureAwait ( false ) ;
209
+ await state . Agent . _context . SendRequestAsync ( state . Agent , state . Request , ct ) . ConfigureAwait ( false ) ;
210
210
211
211
await completion . Task . ConfigureAwait ( false ) ;
212
212
} ,
@@ -231,11 +231,11 @@ public async ValueTask PublishEventAsync(CloudEvent item, CancellationToken canc
231
231
activity ? . SetTag ( "peer.service" , $ "{ item . Type } /{ item . Source } ") ;
232
232
233
233
// TODO: fix activity
234
- _context . Update ( activity , item ) ;
234
+ _context . Update ( item , activity ) ;
235
235
await this . InvokeWithActivityAsync (
236
- static async ( ( AgentBase Agent , CloudEvent Event ) state ) =>
236
+ static async ( ( AgentBase Agent , CloudEvent Event ) state , CancellationToken ct ) =>
237
237
{
238
- await state . Agent . _context . PublishEventAsync ( state . Event ) . ConfigureAwait ( false ) ;
238
+ await state . Agent . _context . PublishEventAsync ( state . Event , ct ) . ConfigureAwait ( false ) ;
239
239
} ,
240
240
( this , item ) ,
241
241
activity ,
0 commit comments