Skip to content

Commit

Permalink
Merge pull request #1388 from rabbitmq/rabbitmq-dotnet-client-1355
Browse files Browse the repository at this point in the history
Start main reader loop using the default TaskScheduler
  • Loading branch information
lukebakken committed Sep 25, 2023
2 parents 6677851 + b502081 commit 66f499a
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 72 deletions.
2 changes: 2 additions & 0 deletions projects/RabbitMQ.Client/client/api/ConnectionFactory.cs
Expand Up @@ -428,7 +428,9 @@ public ICredentialsProvider CredentialsProvider

/// <summary>
/// When set to true, background thread will be used for the I/O loop.
/// NB: No-op
/// </summary>
[Obsolete("Currently a no-op. UseBackgroundThreadsForIO will be removed in version 7")]
public bool UseBackgroundThreadsForIO { get; set; }

/// <summary>
Expand Down
8 changes: 5 additions & 3 deletions projects/RabbitMQ.Client/client/impl/Connection.cs
Expand Up @@ -116,7 +116,8 @@ public Connection(IConnectionFactory factory, bool insist, IFrameHandler frameHa
_session0 = new MainSession(this) { Handler = NotifyReceivedCloseOk };
_model0 = (ModelBase)Protocol.CreateModel(_session0);

StartMainLoop(factory.UseBackgroundThreadsForIO);
StartMainLoop();

try
{
Open(insist);
Expand Down Expand Up @@ -848,9 +849,10 @@ public void MaybeStartHeartbeatTimers()
}
}

public void StartMainLoop(bool useBackgroundThread)
public void StartMainLoop()
{
_mainLoopTask = Task.Factory.StartNew(MainLoop, TaskCreationOptions.LongRunning | TaskCreationOptions.DenyChildAttach);
TaskCreationOptions opts = TaskCreationOptions.LongRunning | TaskCreationOptions.DenyChildAttach;
_mainLoopTask = Task.Factory.StartNew(MainLoop, CancellationToken.None, opts, TaskScheduler.Default);
}

public void HeartbeatReadTimerCallback(object state)
Expand Down
1 change: 1 addition & 0 deletions projects/Unit/APIApproval.Approve.verified.txt
Expand Up @@ -121,6 +121,7 @@ namespace RabbitMQ.Client
public RabbitMQ.Client.TopologyRecoveryExceptionHandler TopologyRecoveryExceptionHandler { get; set; }
public RabbitMQ.Client.TopologyRecoveryFilter TopologyRecoveryFilter { get; set; }
public System.Uri Uri { get; set; }
[System.Obsolete("Currently a no-op. UseBackgroundThreadsForIO will be removed in version 7")]
public bool UseBackgroundThreadsForIO { get; set; }
public string UserName { get; set; }
public string VirtualHost { get; set; }
Expand Down
69 changes: 0 additions & 69 deletions projects/Unit/TestConnectionWithBackgroundThreads.cs

This file was deleted.

0 comments on commit 66f499a

Please sign in to comment.