Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cancel on waiting jobs should be protected #25

Closed
hellysmile opened this issue Jan 21, 2018 · 1 comment
Closed

Cancel on waiting jobs should be protected #25

hellysmile opened this issue Jan 21, 2018 · 1 comment

Comments

@hellysmile
Copy link
Member

hellysmile commented Jan 21, 2018

Example:

from aiohttp import web
from aiojobs.aiohttp import setup, spawn

async def handler(request):
    await spawn(request, coro())
    return web.Response()

app = web.Application()
app.router.add_get('/', handler)
setup(app)

Cancellation of await spawn(request, coro()) by https://github.com/aio-libs/aiohttp/pull/2257/files should be covered by asyncio,shield or custom wrapper

As well aiohttp docs for now can use combination of asyncio.shield and spawn to illuminate unexpected behavior

@asvetlov
Copy link
Member

@atomic should be protected and it is after #28
In contrast cancelling spawn() call means that waiting for a free slot in pending queue was not successful, outer task was closed earlier.

I don't think we have do something here, in practice cancelling on await spawn() could be processed as connection lost before spawn() call -- from web server perspective should be no difference.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants