Esempio n. 1
0
        private async Task StartInternal(CancellationToken cancellationToken)
        {
            TokenCleanup tokenCleanup = this;

            while (!cancellationToken.IsCancellationRequested)
            {
                try
                {
                    await Task.Delay(tokenCleanup._interval, cancellationToken);
                }
                catch (TaskCanceledException)
                {
                    tokenCleanup._logger.LogDebug("TaskCanceledException. Exiting.", Array.Empty <object>());
                    return;
                }
                catch (Exception ex)
                {
                    tokenCleanup._logger.LogError("Task.Delay exception: {0}. Exiting.", (object)ex.Message);
                    return;
                }
                if (cancellationToken.IsCancellationRequested)
                {
                    tokenCleanup._logger.LogDebug("CancellationRequested. Exiting.", Array.Empty <object>());
                    return;
                }
                tokenCleanup.ClearTokens();
            }
            tokenCleanup._logger.LogDebug("CancellationRequested. Exiting.", Array.Empty <object>());
        }
 public TokenCleanupHost(TokenCleanup tokenCleanup, OperationalStoreOptions options)
 {
     _tokenCleanup = tokenCleanup;
     _options      = options;
 }