[Twisted-Python] LoopingCall and object instances

Ladislav Andel ladaan at iptel.org
Wed Aug 22 12:14:17 MDT 2007


Hello,
I have got following code:

hosts = ['google.com','yahoo.com']

for host in hosts:
        c = PingContext(num, host)
        ctx.append(c)
        l = task.LoopingCall(c.ping)
        l.start(30.0, False)

I create a few object instances and pinging those hosts every 30 secs.
I will have another loop through LoopingCall, where I will be checking 
dynamically changing list and comparing with already been checking hosts.
If there is a host missing in the list I will delete the object instance 
which is not in the list.
How can I remove it that it will not be anymore called by LoopingCall?
Or how can I add a new object instance to the LoopingCall in case there 
is new host in the list?

Hopefully, it's understandable.

Thank you,
Lada









More information about the Twisted-Python mailing list