mirror of https://github.com/zulip/zulip.git
upgrade-zulip: Shutdown servers with <3GB RAM when buiding static.
Fixes #14643. This is to avoid running out of memory when building static assets with webpack while server is running in low ram systems.
This commit is contained in:
parent
81195abdbd
commit
da84b19aea
|
@ -158,6 +158,18 @@ if args.ignore_static_assets:
|
|||
# cannot run `tools/update-prod-static`.
|
||||
pass
|
||||
elif args.from_git:
|
||||
# Because `upgrade-zulip-from-git` needs to build static assets, it
|
||||
# is at risk of being OOM killed on systems with limited free RAM.
|
||||
mem_bytes = os.sysconf('SC_PAGE_SIZE') * os.sysconf('SC_PHYS_PAGES')
|
||||
mem_gib = mem_bytes/(1024.**3) # e.g. 3.74
|
||||
|
||||
# Ideally, we'd have 2 thresholds here, depending on whether the
|
||||
# system is running queue workers multithreaded or multiprocess.
|
||||
# See puppet/zulip/manifests/app_frontend_base.pp for background.
|
||||
if mem_gib < 3.8:
|
||||
logging.info("Shutting down server to build static assets on a low-RAM system.")
|
||||
shutdown_server()
|
||||
|
||||
# Note: The fact that this is before we apply puppet changes means
|
||||
# that we don't support adding new puppet dependencies of
|
||||
# update-prod-static with the git upgrade process. But it'll fail
|
||||
|
|
Loading…
Reference in New Issue