File size: 692 Bytes
2411edd
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
"""账号同步工作的有界准入与关闭等待。"""
from fastapi import HTTPException
from owned_thread import OwnedThreadGroup

MAX_AUTH_IO = 8
MAX_IDENTITY_IO = 32


class AuthIO(OwnedThreadGroup):
    def __init__(self, capacity=MAX_AUTH_IO):
        super().__init__(capacity, lambda: HTTPException(status_code=503, detail='用户数据暂不可用'))


_auth_io = AuthIO()
run_auth_io = _auth_io.run
start_auth_io = _auth_io.start
stop_auth_io = _auth_io.stop
close_auth_io = _auth_io.close

_identity_io = AuthIO(MAX_IDENTITY_IO)
run_identity_io = _identity_io.run
start_identity_io = _identity_io.start
stop_identity_io = _identity_io.stop
close_identity_io = _identity_io.close