Exemple #1
0
        protected override void Go(string[] args)
        {
            var shouldRunContinuously = args.Length == 0 || !args[0].Equals("once", StringComparison.InvariantCultureIgnoreCase);

            _lastUpdate = DateTimeOffset.Now;
            _log.Info($"Running. Currently, there are {_tweetTasks.Get().Count} scheduled tasks.");
            while (true)
            {
                var time = DateTimeOffset.Now;
                _tweetTasks.Update(RunScheduledTasks(time));
                _likeTasks.Update(RunScheduledTasks(time));
                _automaton.Update(time - _lastUpdate);
                _lastUpdate = time;
                if (!shouldRunContinuously)
                {
                    return;
                }
                Thread.Sleep(1000);
            }
        }