0

i would like understand how its possible. I have in my project one linq cannot wait for response of api of twitch, and i would like understand why cannot waiting?

System.Threading.Timer _timer = new System.Threading.Timer(TimerCallback, null, 0, 120000);

private static async void TimerCallback(Object o)
{
    Console.WriteLine(DateTime.Now);

    lstTwitch.ToList().ForEach(async item =>
    {
        if (item.PathsImagem == null)
            item.PathsImagem = await Twitch.CollectImage(item.idUser.ToString());
        TwitchStream dataStream = await Twitch.CollectDataOfStream(item.idUser.ToString());
        if (Convert.ToDateTime(dataStream.started_at) != Convert.ToDateTime(item.UltimaStream))
        {

        }
    });
}
        

    

Twitch.CollectDataOfStream:
Twitch.CollectDataOfStream

The problem is not in request api, but is the time of linq give to receive data. When start request on api he return on line of TwitchStream dataStream = await Twitch.CollectDataOfStream(item.idUser.ToString());

Enigmativity
  • 113,464
  • 11
  • 89
  • 172
Carl
  • 9
  • 2

0 Answers0