chgserver: disable AppNap on macOS

Summary:
We suspect AppNap can make chgserver very slow.
Disable AppNap to see if it helps.

Differential Revision: D40185563

fbshipit-source-id: 0740ed0b3e7e68c82c40cc905136365bc6386f8c
This commit is contained in:
Jun Wu 2022-10-07 14:34:45 -07:00 committed by Facebook GitHub Bot
parent be83e8a1fa
commit ea03d0f012

View File

@ -379,6 +379,16 @@ class chgunixservicehandler(object):
return chgcmdserver(self.ui, repo, fin, fout, conn, self._baseaddress)
def _disable_app_nap():
"""disable AppNap on macOS.
AppNap might slow down the server to the point it's unusable.
"""
if pycompat.isdarwin:
import appnope
appnope.nope()
def chgunixservice(ui, repo, opts):
# CHGINTERNALMARK is set by chg client. It is an indication of things are
# started by chg so other code can do things accordingly, like disabling
@ -392,4 +402,5 @@ def chgunixservice(ui, repo, opts):
# one chgserver can serve multiple repos. drop repo information
ui.setconfig("bundle", "mainreporoot", "", "repo")
h = chgunixservicehandler(ui)
_disable_app_nap()
return commandserver.unixforkingservice(ui, repo=None, opts=opts, handler=h)