LXC-Web-Panel
LXC-Web-Panel copied to clipboard
Multithreading support
Currently, Flask is running in single thread, hence access from different places is not possible if there is some container operation.
Possible implementations:
- Start Flask with "threaded=True" option
- Dedicate extra thread to LXC API access
- Asynchronous LXC API (if possible)
Option 1 seems to be working fine, but some testing needs to be done (especially testing If LXC api is threadsafe - for example multiple container creation at the same time). Option 2 can be used if option 3 isn't possible (either new thread for every LXC request or one thread with thread-safe queue)
Combination of 1 and 2 seems to be efficient and safe even if LXC API cannot be accessed in threaded way (single thread-safe queue with one worker also handles concurrency -> for example deletion of container that is currently in process of creation)
Since LXC API is for Python 3 (i guess) and API here uses subprocesses, it could create concurrent issue situation (e.g. starting container before it's created)
TBD: add backup action into queue, refactor it a bit, display processed items / items in queue
Hey @DarkKnightCZ which is the status of this branch? There are missing features of the code that need further rework or it is ready to be merged?