mirror of
https://github.com/langbot-app/LangBot.git
synced 2026-06-09 07:16:04 +00:00
chore: 代码格式优化
This commit is contained in:
@@ -1,4 +1,6 @@
|
||||
import threading
|
||||
from pkg.utils import ThreadCtl
|
||||
|
||||
|
||||
context = {
|
||||
'inst': {
|
||||
@@ -78,14 +80,15 @@ def get_plugin_host():
|
||||
context_lock.release()
|
||||
return t
|
||||
|
||||
|
||||
def set_thread_ctl(inst):
|
||||
context_lock.acquire()
|
||||
context['pool_ctl'] = inst
|
||||
context_lock.release()
|
||||
|
||||
from pkg.utils import ThreadCtl
|
||||
|
||||
def get_thread_ctl() -> ThreadCtl:
|
||||
context_lock.acquire()
|
||||
t = context['pool_ctl']
|
||||
t: ThreadCtl = context['pool_ctl']
|
||||
context_lock.release()
|
||||
return t
|
||||
return t
|
||||
|
||||
@@ -1,7 +1,9 @@
|
||||
from concurrent.futures import ThreadPoolExecutor, Future
|
||||
import threading, time
|
||||
import threading
|
||||
import time
|
||||
from concurrent.futures import ThreadPoolExecutor
|
||||
|
||||
class Pool():
|
||||
|
||||
class Pool:
|
||||
'''
|
||||
线程池结构
|
||||
'''
|
||||
@@ -28,7 +30,8 @@ class Pool():
|
||||
continue
|
||||
time.sleep(1)
|
||||
|
||||
class ThreadCtl():
|
||||
|
||||
class ThreadCtl:
|
||||
def __init__(self, sys_pool_num, admin_pool_num, user_pool_num):
|
||||
'''
|
||||
线程池控制类
|
||||
|
||||
Reference in New Issue
Block a user