示例#1
0
        public async Task Start(CancellationToken cancellationToken = default)
        {
            // Clean all old client connect information
            await _clientStore.DisconnectAllClients();

            while (!cancellationToken.IsCancellationRequested)
            {
                var node = new Node
                {
                    ConnectionString = _options.QuartzConnectionString,
                    SchedInstanceId  = _options.SchedInstanceId,
                    Provider         = _options.Provider,
                    SchedName        = _options.SchedName,
                    IsConnected      = true,
                    TriggerTimes     = 0
                };
                await _sharding.RegisterNode(node);

                await Task.Delay(TimeSpan.FromMilliseconds(5000), cancellationToken).ConfigureAwait(true);

                _logger.LogInformation("SSN heartbeat");
            }
        }