Beispiel #1
0
        private static void StartPolling(TelegramApi api)
        {
            Logger.Debug("Starting polling");
            Task pollingTask = api.StartPolling();

            pollingTask.ContinueWith(
                e =>
            {
                Logger.Error(e.Exception, "An error occurred while retrieving updates");
                Thread.Sleep(retryPollingDelay);
                StartPolling(api);
            },
                TaskContinuationOptions.OnlyOnFaulted);
        }
Beispiel #2
0
        private static void StartPolling(TelegramApi tgApi)
        {
            Logger.Debug("Starting polling");
            Task pollingTask = tgApi.StartPolling();

            pollingTask.ContinueWith(e =>
            {
                Logger.Error(e.Exception, "An error occurred while retrieving updates");
                Thread.Sleep(_retryPollingDelay);
                StartPolling(tgApi);
            },
              TaskContinuationOptions.OnlyOnFaulted);
        }
Beispiel #3
0
 private static void StartPolling(TelegramApi tgApi)
 {
     //Logger.Debug("Starting polling");
     Task pollingTask = tgApi.StartPolling();
     pollingTask.ContinueWith(e =>
     {
         //Logger.Error(e.Exception, "An error occurred while retrieving updates");
         new Timer(o =>
         {
             StartPolling(tgApi);
         }, null, _retryPollingDelay, -1);
     },
       TaskContinuationOptions.OnlyOnFaulted);
 }