make third_party.utils.make_toot async

This commit is contained in:
io 2021-07-26 06:29:20 +00:00
parent 4e4619fbe0
commit d0965d437b
3 changed files with 7 additions and 31 deletions

View file

@ -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