mirror of
https://github.com/yasirarism/MissKatyPyro.git
synced 2026-01-07 12:24:51 +00:00
Fix
This commit is contained in:
parent
308467ed1c
commit
544ff6465b
1 changed files with 2 additions and 2 deletions
|
|
@ -1,9 +1,8 @@
|
||||||
import asyncio
|
import asyncio
|
||||||
|
|
||||||
loop = asyncio.get_running_loop()
|
|
||||||
|
|
||||||
def asyncify(func):
|
def asyncify(func):
|
||||||
async def inner(*args, **kwargs):
|
async def inner(*args, **kwargs):
|
||||||
|
loop = asyncio.get_running_loop()
|
||||||
func_out = await loop.run_in_executor(None, func, *args, **kwargs)
|
func_out = await loop.run_in_executor(None, func, *args, **kwargs)
|
||||||
return func_out
|
return func_out
|
||||||
|
|
||||||
|
|
@ -13,6 +12,7 @@ def new_task(func):
|
||||||
@wraps(func)
|
@wraps(func)
|
||||||
def wrapper(*args, **kwargs):
|
def wrapper(*args, **kwargs):
|
||||||
try:
|
try:
|
||||||
|
loop = asyncio.get_running_loop()
|
||||||
return loop.create_task(func(*args, **kwargs))
|
return loop.create_task(func(*args, **kwargs))
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
LOGGER.error(f"Failed to create task for {func.__name__} : {e}")
|
LOGGER.error(f"Failed to create task for {func.__name__} : {e}")
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue