-
Kirill Smelkov authored
We will soon need to run 2 threads: - one with the main logger, and - another one to serve requests for synthetic x.drb_stats queries Both main and the second thread will be run via sync.WorkGroup to cancel each other in case of failure somewhere. So since WorkGroup.wait(), similarly to all pygolang operations, is not interrupted by signals(*), we need to wire ctx to be passed through all operations and manage to cancel that context on SIGINT/SIGTERM. This patch: 1. adjusts xlog to wire ctx through all call chains and moves ._xlog1() to be run in the thread. 2. adjusts amari.Conn to take ctx as argument on all operations and react reasonably on that ctx cancel. We need to do it here because xlog uses Conn internally. 3. adjusts xamari main driver to setup root context that is canceled on SIGINT/SIGTERM similarly e.g. to how nxdtest does it in nexedi/nxdtest@b0cf277d . (*) see nexedi/pygolang@e18adbab for details.
79d10eb9