classification
Title: Add asyncio.TimerHandle.when() function
Type: Stage: resolved
Components: asyncio Versions: Python 3.8, Python 3.7
process
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: Nosy List: asvetlov, ned.deily, yselivanov
Priority: normal Keywords: patch

Created on 2018-02-01 12:08 by asvetlov, last changed 2018-02-01 19:56 by asvetlov. This issue is now closed.

Pull Requests
URL Status Linked Edit
PR 5473 merged asvetlov, 2018-02-01 15:55
PR 5480 merged miss-islington, 2018-02-01 18:01
Messages (10)
msg311421 - (view) Author: Andrew Svetlov (asvetlov) * (Python committer) Date: 2018-02-01 12:08
Should just return self._when attribute.

I need it for testing purposes.
Without the method there is no possibility to figure out scheduled wakeup time.
An alternative is waiting for callback but the approach increases unittest execution time and not very reliable.

I don't like looking into `handler._when` private property, uvloop does not expose it.

Ned, is it possible to include the feature into Python 3.7? 
The change is safe and tiny, no backward compatibility problems etc.
msg311430 - (view) Author: Yury Selivanov (yselivanov) * (Python committer) Date: 2018-02-01 14:20
How will such test look like? I'm still not sure we need it.
msg311433 - (view) Author: Andrew Svetlov (asvetlov) * (Python committer) Date: 2018-02-01 15:09
In aiohttp we have HTTP keepalivve support.

A function schedules a delayed callback.
On processing a new request the callback is cancelled and rescheduled to a new time.

I like to check cancellation state (now it is possible with public API) and scheduled time.

I did the check with mocking but proposed method allows to do it easy and more obviously.
msg311436 - (view) Author: Yury Selivanov (yselivanov) * (Python committer) Date: 2018-02-01 15:17
OK, makes sense. Can you submit a PR?
msg311438 - (view) Author: Ned Deily (ned.deily) * (Python committer) Date: 2018-02-01 15:24
Let's get it into master for 3.8 first and then we'll have something to discuss.
msg311442 - (view) Author: Yury Selivanov (yselivanov) * (Python committer) Date: 2018-02-01 15:57
The PR is LGTM.  Up to Ned to allow this in 3.7.  I agree that the feature is (a) trivial, (b) new, so it's safe to go in 3.7.
msg311443 - (view) Author: Yury Selivanov (yselivanov) * (Python committer) Date: 2018-02-01 15:59
> Let's get it into master for 3.8 first and then we'll have something to discuss.

The PR has a "versionadded" tag.  If you plan to allow this, Andrew can commit it set to 3.7...
msg311448 - (view) Author: Ned Deily (ned.deily) * (Python committer) Date: 2018-02-01 16:41
We have feature freezes for a good reason.  But I will trust your judgement on this one. (Removing 3.6 for version list.)
msg311449 - (view) Author: Yury Selivanov (yselivanov) * (Python committer) Date: 2018-02-01 16:46
Andrew, I'm indifferent about this feature.  It's entirely up to you if you want to merge it in 3.7.  I already used up my allowance for post-beta1 feature merges.
msg311460 - (view) Author: Andrew Svetlov (asvetlov) * (Python committer) Date: 2018-02-01 18:01
Thanks.
Let's do it.
The addition is really very trivial.
History
Date User Action Args
2018-02-01 19:56:50asvetlovsetstatus: open -> closed
resolution: fixed
stage: patch review -> resolved
2018-02-01 18:01:55miss-islingtonsetpull_requests: + pull_request5310
2018-02-01 18:01:00asvetlovsetmessages: + msg311460
2018-02-01 16:46:46yselivanovsetmessages: + msg311449
2018-02-01 16:41:14ned.deilysetmessages: + msg311448
versions: - Python 3.6
2018-02-01 15:59:10yselivanovsetmessages: + msg311443
2018-02-01 15:57:48yselivanovsetmessages: + msg311442
2018-02-01 15:55:53asvetlovsetkeywords: + patch
stage: patch review
pull_requests: + pull_request5300
2018-02-01 15:24:08ned.deilysetmessages: + msg311438
2018-02-01 15:17:35yselivanovsetmessages: + msg311436
2018-02-01 15:09:24asvetlovsetmessages: + msg311433
2018-02-01 14:20:26yselivanovsetmessages: + msg311430
2018-02-01 12:08:36asvetlovcreate