The common denominator here were all places that used connection objects from multiprocessing.Pipe. The documentation comment was wrong, as it isn't the pipe that is used, but one of the two Connection objects.
For the multiprocessing.Lock objects used, the acquire() and release() were changed to use a context manager, making sure (to the extents possible) that the resource is released even on errors. This was tested more than a month ago, in the same work where for the PR that did some profiling and benchmarking with hyperfine. (I was trying alternatives to this kind of RPC server, but I wasn't satisfied with what I got). However, the context manager and locks are a good practice that is valuable to include.
While I did try to completely type the messages class and file, I reverted it as it wasn't that much clearer, only correctly understood with very new Python syntax, and changed lists to tuples. Nevertheless, type checking of the possible data received highlighted the fact that the docs (which I wrote the typing from) didn't include the "INFORMATION" level, as it was "unused". That is what is nice when type checking and using Literal[] for expected values. So the docstring is updated in consequence.
The common denominator here were all places that used connection objects from
multiprocessing.Pipe
. The documentation comment was wrong, as it isn't the pipe that is used, but one of the two Connection objects.For the
multiprocessing.Lock
objects used, theacquire()
andrelease()
were changed to use a context manager, making sure (to the extents possible) that the resource is released even on errors. This was tested more than a month ago, in the same work where for the PR that did some profiling and benchmarking with hyperfine. (I was trying alternatives to this kind of RPC server, but I wasn't satisfied with what I got). However, the context manager and locks are a good practice that is valuable to include.While I did try to completely type the messages class and file, I reverted it as it wasn't that much clearer, only correctly understood with very new Python syntax, and changed lists to tuples. Nevertheless, type checking of the possible data received highlighted the fact that the docs (which I wrote the typing from) didn't include the "INFORMATION" level, as it was "unused". That is what is nice when type checking and using
Literal[]
for expected values. So the docstring is updated in consequence.