If you are on the free plan and wish to workaround the 30 seconds limitation, this may be the beginning of a path to the simplest solution, as @stefano.menci said.
Here is a link to another question about how to store files in a data table, where I made them a clone link to see an example of how it works.
Edit:
Once you have it in a data table and working, you could:
- Use uplink as you have suggested. You don’t actually HAVE to run uplink as
anvil.server.run_forever()
as the docs suggest. You could - Run a while loop with a
time.sleep()
function that checks your anvil data table for a file to process every 5 seconds or so, then - does that work that takes longer than 30 seconds, and
- returns it marking it as done in a
bool
column of the table. You could then - set a timer component on your anvil app to check to see if the file is done and
- create the link to the data table for the user on the anvil form.
Edit 2:
Forgot to add this about background tasks:
Here is a link to another cloneable example app I created that is about a different topic (async components) but shows off working background tasks quite nicely.