Inline _set_gc into _set_envs_and_config (#33538)
This commit is contained in:
@@ -22,6 +22,7 @@ from __future__ import annotations
|
|||||||
import asyncio
|
import asyncio
|
||||||
import atexit
|
import atexit
|
||||||
import dataclasses
|
import dataclasses
|
||||||
|
import gc
|
||||||
import logging
|
import logging
|
||||||
import multiprocessing as mp
|
import multiprocessing as mp
|
||||||
import os
|
import os
|
||||||
@@ -1018,7 +1019,6 @@ class Engine(EngineScoreMixin, EngineBase):
|
|||||||
load_plugins()
|
load_plugins()
|
||||||
|
|
||||||
server_args.check_server_args()
|
server_args.check_server_args()
|
||||||
_set_gc(server_args)
|
|
||||||
|
|
||||||
# Allocate ports for inter-process communications
|
# Allocate ports for inter-process communications
|
||||||
if port_args is None:
|
if port_args is None:
|
||||||
@@ -1627,11 +1627,8 @@ def _set_envs_and_config(server_args: ServerArgs):
|
|||||||
# Set mp start method
|
# Set mp start method
|
||||||
mp.set_start_method("spawn", force=True)
|
mp.set_start_method("spawn", force=True)
|
||||||
|
|
||||||
|
# Set gc threshold
|
||||||
def _set_gc(server_args: ServerArgs):
|
|
||||||
if gc_threshold := server_args.gc_threshold:
|
if gc_threshold := server_args.gc_threshold:
|
||||||
import gc
|
|
||||||
|
|
||||||
gc.set_threshold(*gc_threshold)
|
gc.set_threshold(*gc_threshold)
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user