public void Start()
        {
            if (_settings.RunBackEndJobs)
            {
                Task.Run(async() =>
                {
                    await Setup();
                    _isSetup = true;


                    while (true)
                    {
                        await _quickSync.ResetToken <TP>();
                        try
                        {
                            _logger.LogInformation($"Running: {GetType().Name}");
                            await Execute();
                        }
                        catch (Exception ex)
                        {
                            _logger.LogError(ex, "Running Service Loop");
                        }

                        var token = await _quickSync.GetToken <TP>();
                        try
                        {
                            await Task.Delay(_delay, token);
                        }
                        catch (TaskCanceledException)
                        {
                        }
                    }
                });
            }
        }
Example #2
0
        public void Start()
        {
            if (_settings.RunBackEndJobs)
            {
                Task.Run(async() =>
                {
                    while (true)
                    {
                        await _quickSync.ResetToken <TP>();
                        try
                        {
                            await Execute();
                        }
                        catch (Exception ex)
                        {
                            _logger.LogError(ex, "Running Service Loop");
                        }

                        var token = await _quickSync.GetToken <TP>();
                        await Task.Delay(_delay, token);
                    }
                });
            }
        }