make third_party.utils.make_toot async
This commit is contained in:
parent
4e4619fbe0
commit
d0965d437b
3 changed files with 7 additions and 31 deletions
7
utils.py
7
utils.py
|
|
@ -1,12 +1,11 @@
|
|||
# SPDX-License-Identifier: AGPL-3.0-only
|
||||
|
||||
import anyio
|
||||
import functools
|
||||
from bs4 import BeautifulSoup
|
||||
from functools import wraps
|
||||
|
||||
def shield(f):
|
||||
@functools.wraps(f)
|
||||
@wraps(f)
|
||||
async def shielded(*args, **kwargs):
|
||||
with anyio.CancelScope(shield=True) as cs:
|
||||
with anyio.CancelScope(shield=True):
|
||||
return await f(*args, **kwargs)
|
||||
return shielded
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue