Ticket #2633 (closed enhancement: fixed)

Opened 3 years ago

Last modified 3 years ago

LoopingCall should parameterize its scheduler

Reported by: radix Owned by: radix
Priority: highest Milestone:
Component: core Keywords:
Cc: therve Branch:
Author: Launchpad Bug:

Description

_callLater and _seconds should both be provided or obsoleted by parameterized functions or a Clock/reactor-like object.

Change History

Changed 3 years ago by radix

  • keywords review added
  • owner radix deleted

Up for review at parameterize-loopingcall-scheduler-2633, which also attempts to resolve #2634.

Changed 3 years ago by therve

  • keywords review removed
  • cc therve added
  • owner set to radix
  • priority changed from normal to highest
  • I don't really like the setClock method. I mean, anybody can do loop.clock = foo, right?
  • the variable new_time in t.i.base should be named newTime
  • the docstring of seconds in t.i.interfaces should be
    """
    blah.
    """
    
    Don't hesitate to clean the docstrings of IReactorTime :)
  • the test_seconds is a bit insane, but I guess you have a reason for that

Apart from nitpicking, that looks really great, so please merge when you're ok.

Changed 3 years ago by therve

One last thing: can you update the copyright notices of the touched files? Thanks.

Changed 3 years ago by radix

  • status changed from new to closed
  • resolution set to fixed

(In [20273]) Merge parameterize-looping-call-2633.

Author: radix Reviewer: therve Fixes #2633 Fixes #2634

LoopingCall (and code which uses it) is now much more testable because the scheduler it uses is overridable. In support of this, a 'seconds' method was added to the reactor (IReactorTime) to strengthen the logical grouping of 'what is the current scheduling-time' and 'schedule a call for later'.

Note: See TracTickets for help on using tickets.