File tree Expand file tree Collapse file tree 3 files changed +16
-19
lines changed Expand file tree Collapse file tree 3 files changed +16
-19
lines changed Original file line number Diff line number Diff line change @@ -103,10 +103,23 @@ internal CreateChannelOptions(ConnectionConfig connectionConfig)
103
103
_connectionConfigContinuationTimeout = connectionConfig . ContinuationTimeout ;
104
104
}
105
105
106
- internal void WithConnectionConfig ( ConnectionConfig connectionConfig )
106
+ private void WithConnectionConfig ( ConnectionConfig connectionConfig )
107
107
{
108
108
_connectionConfigConsumerDispatchConcurrency = connectionConfig . ConsumerDispatchConcurrency ;
109
109
_connectionConfigContinuationTimeout = connectionConfig . ContinuationTimeout ;
110
110
}
111
+
112
+ internal static CreateChannelOptions CreateOrUpdate ( CreateChannelOptions ? createChannelOptions , ConnectionConfig config )
113
+ {
114
+ if ( createChannelOptions is not null )
115
+ {
116
+ createChannelOptions . WithConnectionConfig ( config ) ;
117
+ return createChannelOptions ;
118
+ }
119
+ else
120
+ {
121
+ return new CreateChannelOptions ( config ) ;
122
+ }
123
+ }
111
124
}
112
125
}
Original file line number Diff line number Diff line change @@ -256,15 +256,7 @@ public async Task<IChannel> CreateChannelAsync(CreateChannelOptions? createChann
256
256
{
257
257
EnsureIsOpen ( ) ;
258
258
259
- if ( createChannelOptions is null )
260
- {
261
- createChannelOptions = new CreateChannelOptions ( _config ) ;
262
- }
263
- else
264
- {
265
- createChannelOptions . WithConnectionConfig ( _config ) ;
266
- }
267
-
259
+ createChannelOptions = CreateChannelOptions . CreateOrUpdate ( createChannelOptions , _config ) ;
268
260
RecoveryAwareChannel recoveryAwareChannel = await CreateNonRecoveringChannelAsync ( createChannelOptions , cancellationToken )
269
261
. ConfigureAwait ( false ) ;
270
262
Original file line number Diff line number Diff line change @@ -268,15 +268,7 @@ public Task<IChannel> CreateChannelAsync(CreateChannelOptions? createChannelOpti
268
268
{
269
269
EnsureIsOpen ( ) ;
270
270
271
- if ( createChannelOptions is null )
272
- {
273
- createChannelOptions = new CreateChannelOptions ( _config ) ;
274
- }
275
- else
276
- {
277
- createChannelOptions . WithConnectionConfig ( _config ) ;
278
- }
279
-
271
+ createChannelOptions = CreateChannelOptions . CreateOrUpdate ( createChannelOptions , _config ) ;
280
272
ISession session = CreateSession ( ) ;
281
273
return Channel . CreateAndOpenAsync ( createChannelOptions , session , cancellationToken ) ;
282
274
}
You can’t perform that action at this time.
0 commit comments