Skip to content

Commit

Permalink
add PublishingChannelsPoolSize option (#521)
Browse files Browse the repository at this point in the history
Co-authored-by: Thomas Sarmis <t.sarmis@kaizengaming.com>
  • Loading branch information
sarmis and sarmis authored Mar 3, 2024
1 parent 9c79490 commit 1ebd8e8
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,11 @@ IPooledObjectPolicy<IModel> objectPolicy
};

var provider = new DefaultObjectPoolProvider();

if (_options.PublishingChannelsPoolSize.HasValue)
{
provider.MaximumRetained = _options.PublishingChannelsPoolSize.Value;
}

_pubChannelPool = provider.Create(objectPolicy);

Expand Down
5 changes: 5 additions & 0 deletions src/EasyCaching.Core/Configurations/BaseRabbitMQOptions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -56,5 +56,10 @@ public class BaseRabbitMQOptions
/// Gets or sets the client-provided name for the rabbit connection. Default null (handled by rabbit client)
/// </summary>
public string ClientProvidedName { get; set; }

/// <summary>
/// Sets the Pool size for the publishing channels, if null the default is used (default = cpu core count x 2)
/// </summary>
public int? PublishingChannelsPoolSize { get; set; } = null;
}
}

0 comments on commit 1ebd8e8

Please sign in to comment.