Archived
1
0
Fork 0
This repository has been archived on 2024-04-26. You can view files and clone it, but cannot push or open issues or pull requests.
akari-bot/modules/calc/utils.py
2023-08-19 16:58:07 +08:00

25 lines
995 B
Python

import os
import sys
def invoke():
if sys.version_info.minor > 8 or (sys.version_info.minor == 8 and sys.version_info.micro >=
14): # Added in 3.8.14, 3.7 and below not supported so
sys.set_int_max_str_digits(0)
if os.name == 'posix' and os.uname().sysname != 'Darwin':
os.nice(15)
import resource
resource.setrlimit(resource.RLIMIT_AS,
(16 * 1024 * 1024, 16 * 1024 * 1024))
resource.setrlimit(resource.RLIMIT_DATA,
(16 * 1024 * 1024, 16 * 1024 * 1024))
resource.setrlimit(resource.RLIMIT_STACK,
(16 * 1024 * 1024, 16 * 1024 * 1024))
elif os.name == 'nt':
import win32process
win32process.SetPriorityClass(win32process.GetCurrentProcess(
), 16384)
win32process.SetProcessWorkingSetSize(
win32process.GetCurrentProcess(), 1, 16 * 1024 * 1024)