• Jason Madden's avatar
    Try to adhere to scheduling deadlines when running callbacks · 2aaf265f
    Jason Madden authored
    This should result in the loop getting serviced more often when there
    are many callbacks to run. This is hooked up to `getswitchinterval` to
    allow control.
    
    We check the interval every 50 callbacks. That's hardcoded, which I
    don't like, but the 1000 callback number was hardcoded before, so it's
    not really much of a change. A future extension would be to calculate
    the check number dynamically based on dividing the switch interval.
    
    I don't have a specific test case for this change because I'm a little
    fried, but all the other tests pass. I did manually verify that the
    example in #1071 matches expectations---that could probably be turned
    into a test case with some work.
    
    Fixes #1072
    Fixes #1071
    Fixes #1068
    2aaf265f
test__os.py 3.09 KB