coravel
coravel copied to clipboard
Fluent configurations
AS-IS
Currently, To use Coravel Queue, I have to use functions below
public void ConfigureServices(IServiceCollection services)
{
services.AddQueue();
}
public static IApplicationBuilder UseCoravel(this IApplicationBuilder app)
{
app.ApplicationServices.ConfigureQueue();
return app;
}
TO-BE
1. Queue Consumption Delay with milliseconds
For better customizable options, I propose that the delay time can be set with milliseconds.
-
AS-IS
public Task StartAsync(CancellationToken cancellationToken) { // ... this._timer = new Timer( (state) => this._signal.Release(), null, TimeSpan.Zero, TimeSpan.FromSeconds(consummationDelay)); // ... }
-
TO-BE
public Task StartAsync(CancellationToken cancellationToken) { // ... this._timer = new Timer( (state) => this._signal.Release(), null, TimeSpan.Zero, TimeSpan.FromMilliseconds(consummationDelay)); // Change to milliseconds // ... }
2. Add Extension Method for Queue Consummation Delay (or other options)
public void ConfigureServices(IServiceCollection services)
{
services.AddQueue()
.WithConsummationDelay(1000); // 1 second
}