Hi all,
This has been bothering me for ages. Occasionally we would have reports that takes ages (>2 minutes) to generate. On our local testing the report comes out okay after the long processing. However on sending to Production the report will more than often end up showing a Cloudflare 524 error instead of completing.
I am told that Cloudflare limits HTTP requests to 100 seconds. The reports takes 3-4 minutes to execute due to the sheer size of the dataset.
Does Stimulsoft have a method to work around the limit? For example, fire the job, close the connection and display a wait screen, then wait for the server to call back with a completed report?
Working around Cloudflare 100 second timeout?
-
DavidLee82
- Posts: 22
- Joined: Wed Jul 03, 2024 12:52 am
-
Lech Kulikowski
- Posts: 7839
- Joined: Tue Mar 20, 2018 5:34 am
Re: Working around Cloudflare 100 second timeout?
Hello,
You can offload the generation of such heavy reports to the server side.
- Your own lightweight endpoint starts a background task: it loads the .mrt, sets the data sources/variables, and calls report.Render() - this happens outside the request thread, so nothing is left hanging behind Cloudflare while rendering is in progress.
- Once complete, report.SaveDocument() ьуерщв is called, or the report is exported - this saves the actual rendered result, not the template.
- The frontend polls a small status endpoint until the task status becomes "ready".
- When the result is ready, instead of loading the original report (which would trigger a full re-render), you pass the already rendered document to the viewer - report.LoadDocument(). Since it is already rendered, this call returns quickly - the open connection is no longer left hanging.
Thank you.
You can offload the generation of such heavy reports to the server side.
- Your own lightweight endpoint starts a background task: it loads the .mrt, sets the data sources/variables, and calls report.Render() - this happens outside the request thread, so nothing is left hanging behind Cloudflare while rendering is in progress.
- Once complete, report.SaveDocument() ьуерщв is called, or the report is exported - this saves the actual rendered result, not the template.
- The frontend polls a small status endpoint until the task status becomes "ready".
- When the result is ready, instead of loading the original report (which would trigger a full re-render), you pass the already rendered document to the viewer - report.LoadDocument(). Since it is already rendered, this call returns quickly - the open connection is no longer left hanging.
Thank you.
-
DavidLee82
- Posts: 22
- Joined: Wed Jul 03, 2024 12:52 am
Re: Working around Cloudflare 100 second timeout?
Noted with thanks.
-
Lech Kulikowski
- Posts: 7839
- Joined: Tue Mar 20, 2018 5:34 am
Re: Working around Cloudflare 100 second timeout?
Hello,
You are welcome.
You are welcome.