FlowingCode / GridExporterAddon

Other
10 stars 8 forks source link

Control that there are no parallel exports executions #117

Closed mlopezFC closed 3 weeks ago

mlopezFC commented 1 month ago

Feature proposal

Right now if somebody wants to export something it will go ahead and do the actual export. But depending on the output format and the amount of data, the export can use a lot of memory. If there are several users asking for exports at the same time, the memory usage can be a problem. It would be great to provide a feature, that if it is enabled, it would only do one export at a time. If there are more requests for exporting, then they should be queued and the exports should proceed in order.

Describe solution expectations

The solution should be provided in such a way that it would be completely transparent for the user. One thing to take into account is that if for some reason the user that is waiting decided to close the browser or navigate away, it the UI is not present anymore, then the export should be canceled, maybe that can be implemented with weak references.

Additional information

No response

javier-godoy commented 1 month ago

I would put a semaphore around the export itself* (which requires several MB of heap). I see no issues with keeping the files in memory, since they are usually a few KB. The actual issue is memory pressure whie running several exports at the same time.

Configurable properties:

if for some reason the user that is waiting decided to close the browser or navigate away, it the UI is not present anymore, then the export should be canceled

There is no mechanism for interrupting the export thread. That would be a separate issue (and would require some investigation)

mlopezFC commented 1 month ago

There is no mechanism for interrupting the export thread. That would be a separate issue (and would require some investigation)

I was referring to if the user is waiting and the export didn't start yet and they closed the browser (thus the UI is not available anymore), so this check should be made before starting the actual import when it is your turn in the queue

javier-godoy commented 1 month ago

The following expectation has been moved to #127

One thing to take into account is that if for some reason the user that is waiting decided to close the browser or navigate away, it the UI is not present anymore, then the export should be canceled, maybe that can be implemented with weak references.