Skip to content

The solution allows you to create a pool to perform endless tasks and recreate them in case of failure.

Notifications You must be signed in to change notification settings

DeveloperSuccess/PoolInfiniteTasks

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

11 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

ru

Pool Infinite Tasks C#

NuGet version (PoolInfiniteTasks)

The solution allows you to create a pool to perform endless tasks and recreate them in case of failure.

Usage example

using PoolInfiniteTasks;

var cts = new CancellationTokenSource();

cts.CancelAfter(5000);

Func<CancellationToken, Task> myTaskFactory = (cancellationToken) =>
{
    return Task.Run(async () =>
    {
        while (!cancellationToken.IsCancellationRequested)
        {
            // Any of your logic            
            await Task.Delay(1000, cancellationToken);
            Console.WriteLine("Success");
            throw new Exception("test");
        }
    }, cancellationToken);
};

await new PoolInfiniteTasksManager(myTaskFactory, 3).Run(cts.Token);

About

The solution allows you to create a pool to perform endless tasks and recreate them in case of failure.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages