Le 19/11/2011 16:27, David Baelde a écrit :
> 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.
I noticed the effect without identified the cause, which is add_timeout
Thanks !
>
> 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.
Understood.
>
> 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.)
> }.
>
Hmm.hmm :)

Do you mean I should do something like that in create_playlist() telnet 
handler

     def destroy() =
         source.shutdown(s0)
         source.shutdown(output)
         # delay to implement
   end

   dyn_f :=
       list.append( [(uri,destroy())],
                     !dyn_f )

Then in destroy_playlist() telnet handler, something with 
list.iter(fun()-of-the-list, !dyn_f) on matched sources  ?

- where would be keeped s0 and output ?
- how to execute functions contained in a list itself ?

Thanks

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