Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Score big with last-minute savings on the final tickets to FabCon Vienna. Secure your discount

Reply
JagadishNallami
Frequent Visitor

Task.Delay while polling export request in PowerBI is not completed after given interval

Hi there,

 

I am refering the following link to export a power bi report through PowerBi api using C#.

https://learn.microsoft.com/en-us/power-bi/developer/embedded/export-to#code-examples

 

But while polling the request, as mentioned in the link, we are also using await Task.Delay(retryafter), to reduce the frequency of requests for polling. But this Task is not completed within given interval(30 seconds in our case). Due to this the execution is blocked forever and we are not able to export the file. Is there any issue with code mentioned above? I tried using  await Task.Delay(retryafter).ConfigureAwait(false) also but no use.

 

Could someone help in understanding what is hapening in this case and possible solution? 

 

Thank you.

 

1 ACCEPTED SOLUTION
Anonymous
Not applicable

Hi @JagadishNallami 
Thank you for reaching out microsoft fabric community forum.
As @lbendlin metioned ,the delay might be too short and increasing the delay duration might help.  instead of 30 seconds, try using a longer delay like 300 seconds (5 minutes).
Using  ConfigureAwait(false) is a good practice to avoid deadlocks, but it might not be sufficient if the underlying issue is related to the export operation itself.
Ensure that you are not hitting any API rate limits. If you are making frequent requests, the API might be throttling your requests, causing delays or failures

If you need any further assistance or have any questions, please feel free to reach us.

If this post helps, then please give us Kudos and consider Accept it as a solution to help the other members find it more quickly.

Thank you.

View solution in original post

5 REPLIES 5
Anonymous
Not applicable

Hi @JagadishNallami 

May I ask if you have resolved this issue? If so, please mark the helpful reply and accept it as the solution. This will be helpful for other community members who have similar problems to solve it faster.

Thank you

Anonymous
Not applicable

Hi @JagadishNallami 
Thank you for reaching out microsoft fabric community forum.
As @lbendlin metioned ,the delay might be too short and increasing the delay duration might help.  instead of 30 seconds, try using a longer delay like 300 seconds (5 minutes).
Using  ConfigureAwait(false) is a good practice to avoid deadlocks, but it might not be sufficient if the underlying issue is related to the export operation itself.
Ensure that you are not hitting any API rate limits. If you are making frequent requests, the API might be throttling your requests, causing delays or failures

If you need any further assistance or have any questions, please feel free to reach us.

If this post helps, then please give us Kudos and consider Accept it as a solution to help the other members find it more quickly.

Thank you.

lbendlin
Super User
Super User

You need much longer delays. At least 300 seconds.

Hi, here the delay is the value we are receiving in the resposnse headers from the API. Like below

 

var retryAfter = httpMessage.Response.Headers.RetryAfter;

var retryAfterInSec = retryAfter.Delta.Value.Seconds;

await Task.Delay(retryAfterInSec * 1000);

 

You mean to ignore this and add a default timeout?

Try both approaches. We always use 300 seconds and that seems to be robust.

Helpful resources

Announcements
August Power BI Update Carousel

Power BI Monthly Update - August 2025

Check out the August 2025 Power BI update to learn about new features.

August 2025 community update carousel

Fabric Community Update - August 2025

Find out what's new and trending in the Fabric community.

Top Kudoed Authors