I have a personal plan, but when I want to generate a big pdf, after a short period I get the following message: anvil.server.TimeoutError: Server code took too long
According to your last announcement there would be no more limits for background tasks
I use the documentation example and adapt it a little bit:
client side:
def btx_download_pdf_click(self, **event_args):
âââThis method is called when the button is clickedâââ
media_object = anvil.server.call(âcreate_payment_pdfâ, groups=self.groups, owner=self.pharmacy, pdf_selection=self.selection)
anvil.media.download(media_object)
Unfortunately, really unfortunately, generating PDF has the 30 second limit even with dedicated plans, even in background tasks.
The problem is that the PDF generation process is a resource hog and is killed after 30 seconds, regardless of your plan.
The solution is to get your background task to gather all the required data, then start the PDF generation passing all the data already gathered to the form, so the time required for the PDF generation is as short as possible.
You can try to search for PDF timeout in the forum to see other posts addressing the same problem.