files_scripts icon indicating copy to clipboard operation
files_scripts copied to clipboard

Run in background

Open thegabriele97 opened this issue 1 year ago • 2 comments

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

thegabriele97 avatar Apr 24 '24 15:04 thegabriele97

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).

Raudius avatar Apr 25 '24 10:04 Raudius

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).

Raudius avatar Apr 25 '24 10:04 Raudius