mirror of
https://github.com/ioistired/pleroma-ebooks.git
synced 2024-11-20 02:14:52 +01:00
12 lines
239 B
Python
12 lines
239 B
Python
# SPDX-License-Identifier: AGPL-3.0-only
|
|
|
|
import anyio
|
|
from functools import wraps
|
|
|
|
def shield(f):
|
|
@wraps(f)
|
|
async def shielded(*args, **kwargs):
|
|
with anyio.CancelScope(shield=True):
|
|
return await f(*args, **kwargs)
|
|
return shielded
|