Last active
July 20, 2020 13:12
-
-
Save burakcanekici/75b11f4857416dc28ae7f7dbd40473f7 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class MyBackgroundService : HostedService | |
{ | |
private readonly ReadFromURLProvider _readFromURLProvider; | |
public MyBackgroundService(IServiceProvider serviceProvider, ReadFromURLProvider readFromURLprovider) : base(serviceProvider) | |
{ | |
_readFromURLProvider = readFromURLProvider; | |
} | |
public async override Task ExecuteAsync(CancellationToken cancellationToken) | |
{ | |
while (!cancellationToken.IsCancellationRequested) | |
{ | |
await _readFromURLProvider.ExecuteBackgroundTaskAsync(cancellationToken); | |
await Task.Delay(TimeSpan.FromSeconds(15), cancellationToken); | |
} | |
} | |
} |
~be
~be
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
~be