title: Power Query | Loop with delay
body: <p>I'm new to PQ and trying to do following:</p>
  <ol>
  <li>Get updates from server</li>
  <li>Transform it.</li>
  <li>Post data back.</li>
  </ol>
  <p>While code works just fine i'd like it to be performed each N minutes until application closure.
  Also LastMessageId variable should be revaluated after each call of GetUpdates() and i need to somehow call GetUpdates() again with it.</p>
  <p>I've tried Function.InvokeAfter but didn't get how to run it more than once.
  Recursion blow stack out ofc.</p>
  <p>The only solution i see is to use List.Generate but struggle to understand how it can be used with delay.</p>
  <pre><code>let
      //Get list of records
      GetUpdates = (optional offset as number) as list =&gt; 1,
      Updates = GetUpdates(),
      // Store last update_id
      LastMessageId = List.Last(Updates)[update_id],
      // Prepare and response
      Process = (item as record) as record =&gt;
      // Map Process function to each item in the list of records
      Map = List.Transform(Updates, each Process(_))
  in
      Map
  </code></pre>