Ejemplo n.º 1
0
        public async Task Run()
        {
            var messenger = new MessageSender();

            while (true)
            {
                var time = (DateTime.UtcNow - DateTime.UnixEpoch).TotalSeconds;

                if (_proposerNames.Count == 0)
                {
                    continue;
                }
                _proposerIndex = (_proposerIndex + 1) % _proposerNames.Count;

                await messenger.PostMessage(_acceptorNames, "prepare", new Prepare
                {
                    TimePeriod   = (int)time,
                    ProposerName = _proposerNames[_proposerIndex]
                });

                await Task.Delay(LoopDelaySeconds * 1000);
            }
        }