I have a data extraction task, which is refreshing the UI, and once the refresh is done, it is tasking another such call in a task.
private void startTheDataExtraction()
{
Task<JObject> task = Task<JObject>.Factory.StartNew(() =>
{
JObject r = new JObject();
r = DataExtractor.getControllersData();
return r;
});
Task UITask = task.ContinueWith( ( ret ) =>
{
//set the UI controls data
// reshedule next interaction
resheduleDataExtraction();
},
TaskScheduler.FromCurrentSynchronizationContext() );
}
public void resheduleDataExtraction()
{
Task.Delay( 1000 ).ContinueWith( _ =>
{
startTheDataExtraction();
} );
}
- I wonder if at some point this recursive task calling will consume some sort of resources and prevent further the execution in some way ?