Hangfire.AzureCosmosDb icon indicating copy to clipboard operation
Hangfire.AzureCosmosDb copied to clipboard

Add possibility to set Throughputs

Open Exd442scha opened this issue 8 months ago • 0 comments

In the current implementation there's no way to pass the Throughput Properties to set it.

example :

  • Current implementation :
private async Task InitializeAsync(CancellationToken cancellationToken = default)
    {
        // create database
        logger.Info($"Creating database : [{databaseName}]");
        DatabaseResponse databaseResponse = await Client.CreateDatabaseIfNotExistsAsync(databaseName, cancellationToken: cancellationToken);
  • Desired implementation :
private async Task InitializeAsync(ThroughputProperties throughputProperties = null, CancellationToken cancellationToken = default)
    {
        // create database
        logger.Info($"Creating database : [{databaseName}]");
        DatabaseResponse databaseResponse = await Client.CreateDatabaseIfNotExistsAsync(databaseName, throughputProperties, cancellationToken: cancellationToken);

Also it would be better to have two parameters of ThroughputProperties , one for the database and one for the container, maybe a class which contains two properties, example :

public class CosmosThroughputProperties
    {
        public ThroughputProperties DatabaseThroughputProperties { get; set; }

        public ThroughputProperties ContainerThroughputProperties { get; set; }
    }

Thanks,

Exd442scha avatar Nov 07 '23 13:11 Exd442scha