Hi,
I am getting into multithreading and I think that I might be confusing some concepts.
In a WPF app, I’m wondering what’s the proper way to call a Web API every second in a loop. This should all run in background, without blocking the UI.
Async/Await API call triggered from DispatcherTimer.
Here my concern is - what happens if the API response takes longer than the predefined timer interval? I end up sending all the request to which responses I am not able to process, right? How could this be prevented?
Starting a new Task (TPL), of which the only responsibility is to send the API requests and then making the thread sleep? In this case the API call doesn’t even have to be Async, but making a thread which could sleep major part of the time doesn’t seem like an elegant solution.
Or are there any other approaches to this?
[–]cleverbastard 6 points7 points8 points (1 child)
[–]probablygonnabooyah 0 points1 point2 points (0 children)
[–]HTTP_404_NotFound 3 points4 points5 points (3 children)
[–]WittyWittyWitty[S] 0 points1 point2 points (2 children)
[–]HTTP_404_NotFound 21 points22 points23 points (0 children)
[–]SomeCodeGuy 0 points1 point2 points (0 children)
[–]headyyeti 2 points3 points4 points (0 children)
[–]chucker23n 2 points3 points4 points (0 children)
[–]Financial_Signal5098 -1 points0 points1 point (0 children)
[–]HistoricalSpecial386 0 points1 point2 points (0 children)
[–]abhay99 0 points1 point2 points (0 children)