Add: move all git operations into another process #71
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This drasticly speeds up the interface from a user-perspective,
and this is a fancy way of working around the GIL. Ideally we would
use a Git library that is async, which would also resolve this
issue, but with GitPython we are basically 4+ seconds waiting for
"git push" to finish. As that locks the GIL, no other request can
be handled while this is going on.
By moving the git operations to their own process, the main process
can safely continue to serve requests while in the background
git and GitHub are being updated. This is relative safe, as the
application itself doesn't care about git and/or GitHub. Locking
around the use of the out-of-process-git should prevent two
processes trying to access git and/or GitHub.
It is possible that if many people edit pages rapidly, that the
queue of things to commit gets long, and that commits start to
overlap. For example:
create page -> modify -> modify -> modify
All within 5 seconds, will most likely create only two commits,
one with the create, and the rest with all the modifications
in one. It is, however, rather unlikely humans can go through
the interface within 5 seconds to make sane modifications. So
this is considered an accepted edge-case.