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

Add the remaining property into async timeout #20

Closed
Kentzo opened this issue Sep 7, 2017 · 3 comments
Closed

Add the remaining property into async timeout #20

Kentzo opened this issue Sep 7, 2017 · 3 comments

Comments

@Kentzo
Copy link
Contributor

Kentzo commented Sep 7, 2017

It's useful to know how much time is remaining when scheduling tasks that either do not support asyncio's mechanics or provide an independent timeout.
One such example would be running a subprocess with a program that can accept a timeout:

async with timeout(1234) as t:
    p = await asyncio.create_subprocess_exec('iptables', '-w', int(t.remaining), ...)
    await p.wait()
@Kentzo
Copy link
Contributor Author

Kentzo commented Sep 7, 2017

If timeout is invoked with None, then t.remaining should also return None.

@asvetlov
Copy link
Member

asvetlov commented Sep 8, 2017

Please make a Pull Request.

Kentzo added a commit to Kentzo/async-timeout that referenced this issue Sep 8, 2017
- If timeout is not started yet or started unconstrained: remaining is None
- If timeout is expired: remaining is 0.0
- All other: roughly amount of time before TimeoutError is triggered
Kentzo added a commit to Kentzo/async-timeout that referenced this issue Sep 8, 2017
- If timeout is not started yet or started unconstrained: remaining is None
- If timeout is expired: remaining is 0.0
- All other: roughly amount of time before TimeoutError is triggered
asvetlov pushed a commit that referenced this issue Sep 9, 2017
- If timeout is not started yet or started unconstrained: remaining is None
- If timeout is expired: remaining is 0.0
- All other: roughly amount of time before TimeoutError is triggered
@asvetlov
Copy link
Member

asvetlov commented Sep 9, 2017

Fixed by #21

@asvetlov asvetlov closed this as completed Sep 9, 2017
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