2
0
mirror of https://github.com/xcat2/confluent.git synced 2026-05-14 18:34:19 +00:00

Delay async until after daemonize

os.fork shouldn't happen after an async event loop if the child might use the async loop
This commit is contained in:
Jarrod Johnson
2026-03-19 17:27:24 -04:00
parent 40da956a06
commit 7adef74fe9
2 changed files with 8 additions and 6 deletions
+3 -4
View File
@@ -15,7 +15,6 @@
# See the License for the specific language governing permissions and
# limitations under the License.
import asyncio
import sys
import os
@@ -35,12 +34,12 @@ import confluent.main
#try:
import multiprocessing
async def main():
await confluent.main.run(sys.argv)
def main():
confluent.main.run(sys.argv)
if __name__ == '__main__':
#multiprocessing.freeze_support()
#asyncio.get_event_loop().run_until_complete(main())
asyncio.run(main())
main()
#gt = spawn_for_awaitable(confluent.main.run(sys.argv))
#gt.wait()
#except:
+5 -2
View File
@@ -276,8 +276,7 @@ def migrate_db():
configmanager.init()
async def run(args):
asyncio.get_event_loop().set_debug(True)
def run(args):
setlimits()
try:
configmanager.ConfigManager(None)
@@ -314,6 +313,10 @@ async def run(args):
_redirectoutput()
if havefcntl:
_updatepidfile()
asyncio.run(asyncrun())
async def asyncrun():
asyncio.get_event_loop().set_debug(True)
signal.signal(signal.SIGINT, terminate)
signal.signal(signal.SIGTERM, terminate)
atexit.register(doexit)