Taskable component without input(s)

Hi,

Some help/ideas needed. I have taskable component without any inputs (only output). This component just gathers information using httpclient (GET). Component created based-on this example.

WIthout inputs, taskable component has InPreSolve as false all the time. InPreSolve component construct tasks. Now component works when I have dummy input which is not even read. Removing input creates component which goes into loop.

Are there anyway to construct tasks without InPreSolve?

BR

jhs

You can probably just do this in a regular GH_Component
make a couple fields and a method like so:

protected string txt = "";
protected bool q = false;

protected async Task GetWeb(){
    await Task.Delay(2000); // simulate a request; use httpclient GetResponseAsync()
    txt = "finished web query";
    q = true;
    Component.ExpireSolution(true);
  }

then run this in solve:

if (!q)
{
  txt = "waiting to run again";
  Task.Run(() => GetWeb()); // you can start more than one here
  DA.SetData(0, txt);
}
else
{
  q = false; // so next time this runs it queries again
  DA.SetData(0, txt);
}

webq