Hi Martin,

On Wed, Nov 16, 2011 at 9:41 AM, Martin Hamant <[email protected]> wrote:
> the code resides in http://snipt.org/Umll3
> This is the piece of code I wrote that contains metadata update function for
> dynamic source.
> It works well as it is when adding source/link, but

> there is still something to solve when destroying

As you have correctly observed, if you don't stop the poll (which
relies on add_timeout) then the sources are still referenced and don't
completely go away even though the output has been destroyed.

To stop add_timeout, you must make it return a negative value, so it
won't be re-scheduled. I would suggest creating a reference to a
float, used by add_timeout, initially set to the desired polling
delay, and set to -1. when the whole thing is destroyed.

To accommodate this into your code I would suggest adopting a more
general and flexible system. Instead of keeping a list of active
sources, and iterating shutdown on them, maintain a list of functions.
The destroy function associated to one playlist could be something
like { source.shutdown(s0) ; source.shutdown(output) ; delay := (-1.)
}.

Hope this helps,
-- 
David

------------------------------------------------------------------------------
All the data continuously generated in your IT infrastructure 
contains a definitive record of customers, application performance, 
security threats, fraudulent activity, and more. Splunk takes this 
data and makes sense of it. IT sense. And common sense.
http://p.sf.net/sfu/splunk-novd2d
_______________________________________________
Savonet-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/savonet-users

Reply via email to