Run in background
Hello! I am trying to implement a media conversion script that may last for many minutes. Is there a way to execute the script in background? So that the user receive a notification when it is done.
Thank you
Its not directly implemented but you may be able to achieve something similar by configuring the media conversion script to run via Flow.
You would need to create a separate script to trigger the flow, the easiest way would be by adding a tag to the file. Of course this only works for simple scripts that dont have any other user inputs.
This was a planned feature early on (#7) but its not trivial to develop.
Would need to implement a job queue as well as a way to report results and handle execution errors. There are also other challenges to consider such as limiting the amount of background actions a user can perform and handling idempotency (triggering the same action multiple times before execution is finished).
Of course this only works for simple scripts that dont have any other user inputs.
You could also forward the inputs payload to the flow script by adding them as a comment to the file. (comment_create, comments_find).