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 asyncio.TimerHandle.when() function #76922

Closed
asvetlov opened this issue Feb 1, 2018 · 10 comments
Closed

Add asyncio.TimerHandle.when() function #76922

asvetlov opened this issue Feb 1, 2018 · 10 comments
Labels
3.7 (EOL) end of life 3.8 only security fixes topic-asyncio

Comments

@asvetlov
Copy link
Contributor

asvetlov commented Feb 1, 2018

BPO 32741
Nosy @ned-deily, @asvetlov, @1st1
PRs
  • bpo-32741: Implement TimerHandle.when() #5473
  • bpo-32741: [3.7] Implement TimerHandle.when() (GH-5473) #5480
  • Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.

    Show more details

    GitHub fields:

    assignee = None
    closed_at = <Date 2018-02-01.19:56:50.906>
    created_at = <Date 2018-02-01.12:08:36.404>
    labels = ['3.7', '3.8', 'expert-asyncio']
    title = 'Add asyncio.TimerHandle.when() function'
    updated_at = <Date 2018-02-01.19:56:50.906>
    user = 'https://github.com/asvetlov'

    bugs.python.org fields:

    activity = <Date 2018-02-01.19:56:50.906>
    actor = 'asvetlov'
    assignee = 'none'
    closed = True
    closed_date = <Date 2018-02-01.19:56:50.906>
    closer = 'asvetlov'
    components = ['asyncio']
    creation = <Date 2018-02-01.12:08:36.404>
    creator = 'asvetlov'
    dependencies = []
    files = []
    hgrepos = []
    issue_num = 32741
    keywords = ['patch']
    message_count = 10.0
    messages = ['311421', '311430', '311433', '311436', '311438', '311442', '311443', '311448', '311449', '311460']
    nosy_count = 3.0
    nosy_names = ['ned.deily', 'asvetlov', 'yselivanov']
    pr_nums = ['5473', '5480']
    priority = 'normal'
    resolution = 'fixed'
    stage = 'resolved'
    status = 'closed'
    superseder = None
    type = None
    url = 'https://bugs.python.org/issue32741'
    versions = ['Python 3.7', 'Python 3.8']

    @asvetlov
    Copy link
    Contributor Author

    asvetlov commented Feb 1, 2018

    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.

    @asvetlov asvetlov added 3.7 (EOL) end of life 3.8 only security fixes topic-asyncio labels Feb 1, 2018
    @1st1
    Copy link
    Member

    1st1 commented Feb 1, 2018

    How will such test look like? I'm still not sure we need it.

    @asvetlov
    Copy link
    Contributor Author

    asvetlov commented Feb 1, 2018

    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.

    @1st1
    Copy link
    Member

    1st1 commented Feb 1, 2018

    OK, makes sense. Can you submit a PR?

    @ned-deily
    Copy link
    Member

    Let's get it into master for 3.8 first and then we'll have something to discuss.

    @1st1
    Copy link
    Member

    1st1 commented Feb 1, 2018

    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.

    @1st1
    Copy link
    Member

    1st1 commented Feb 1, 2018

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

    @ned-deily
    Copy link
    Member

    We have feature freezes for a good reason. But I will trust your judgement on this one. (Removing 3.6 for version list.)

    @1st1
    Copy link
    Member

    1st1 commented Feb 1, 2018

    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.

    @asvetlov
    Copy link
    Contributor Author

    asvetlov commented Feb 1, 2018

    Thanks.
    Let's do it.
    The addition is really very trivial.

    @asvetlov asvetlov closed this as completed Feb 1, 2018
    @ezio-melotti ezio-melotti transferred this issue from another repository Apr 10, 2022
    Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
    Labels
    3.7 (EOL) end of life 3.8 only security fixes topic-asyncio
    Projects
    None yet
    Development

    No branches or pull requests

    3 participants