Skip to content

Commit d0a3e7e

Browse files
committed
fixup
1 parent 4ed28d7 commit d0a3e7e

File tree

3 files changed

+16
-19
lines changed

3 files changed

+16
-19
lines changed

projects/RabbitMQ.Client/CreateChannelOptions.cs

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -103,10 +103,23 @@ internal CreateChannelOptions(ConnectionConfig connectionConfig)
103103
_connectionConfigContinuationTimeout = connectionConfig.ContinuationTimeout;
104104
}
105105

106-
internal void WithConnectionConfig(ConnectionConfig connectionConfig)
106+
private void WithConnectionConfig(ConnectionConfig connectionConfig)
107107
{
108108
_connectionConfigConsumerDispatchConcurrency = connectionConfig.ConsumerDispatchConcurrency;
109109
_connectionConfigContinuationTimeout = connectionConfig.ContinuationTimeout;
110110
}
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+
}
111124
}
112125
}

projects/RabbitMQ.Client/Impl/AutorecoveringConnection.cs

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -256,15 +256,7 @@ public async Task<IChannel> CreateChannelAsync(CreateChannelOptions? createChann
256256
{
257257
EnsureIsOpen();
258258

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);
268260
RecoveryAwareChannel recoveryAwareChannel = await CreateNonRecoveringChannelAsync(createChannelOptions, cancellationToken)
269261
.ConfigureAwait(false);
270262

projects/RabbitMQ.Client/Impl/Connection.cs

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -268,15 +268,7 @@ public Task<IChannel> CreateChannelAsync(CreateChannelOptions? createChannelOpti
268268
{
269269
EnsureIsOpen();
270270

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);
280272
ISession session = CreateSession();
281273
return Channel.CreateAndOpenAsync(createChannelOptions, session, cancellationToken);
282274
}

0 commit comments

Comments
 (0)