bugfix
This commit is contained in:
parent
3877126d03
commit
488a578a16
@ -3,6 +3,7 @@ from inspect import isfunction, iscoroutinefunction
|
||||
from functools import partial
|
||||
from appPublic.dictObject import DictObject
|
||||
from appPublic.Singleton import SingletonDecorator
|
||||
from appPublic.log import info, error
|
||||
|
||||
@SingletonDecorator
|
||||
class RegisterFunction:
|
||||
@ -18,11 +19,13 @@ class RegisterFunction:
|
||||
def get(self,name):
|
||||
return self.registKW.get(name,None)
|
||||
|
||||
async def exe(name, *args, **kw):
|
||||
async def exe(self, name, *args, **kw):
|
||||
f = self.get(name)
|
||||
if f is None:
|
||||
error(f'{name=} function not registed')
|
||||
return None
|
||||
if iscoroutinefunction(f):
|
||||
info(f'{name=} is coroutine function');
|
||||
return await f(*args, **kw)
|
||||
return f(*args, **kw)
|
||||
|
||||
@ -40,7 +43,10 @@ class RegisterCoroutine:
|
||||
else:
|
||||
self.kw[name].append(func)
|
||||
async def exe(self, name, *args, **kw):
|
||||
fs = self.kw.get(name).copy()
|
||||
fs = self.kw.get(name)
|
||||
if fs is None:
|
||||
return
|
||||
fs = fs.copy()
|
||||
fs.reverse()
|
||||
if fs:
|
||||
for f in fs:
|
||||
|
Loading…
Reference in New Issue
Block a user