[sr-dev] accessing database from a child forked process

Luis Azedo luis.azedo at factorlusitano.com
Fri Aug 29 15:53:05 CEST 2014


Hi,

i have a module that creates 1 extra process where it processes stuff in a
loop.
on some condition i fire a route_event with a fakemsg and its up to the
user of the module to take action, it tries to work like dispatcher module
or htable (mod-init) events.

the problem that i have is that, if i call some function on some module
that performs a database action, the connection is null when it calls
use_table.

in this case i'm making this call
event_route[my_module:my_event]
{
 $var(my_uri) = <<result of some operations>>;
 pres_refresh_watchers("$var(my_uri)", "dialog", 1);
}
presence module makes the call to use_table but this call fails because the
connection is null. presence module is working fine besides this.

if i make this call inside event_route[dispatcher:dst-up] it works.

i think that dispatcher fires the event inside a callback from a registered
timer, so, i think (may be wrong) that it comes from a different process ?

i wonder if i'm missing something from child_init ? need to register
something ?

thanks for your help.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.sip-router.org/pipermail/sr-dev/attachments/20140829/f6fa5f83/attachment.html>


More information about the sr-dev mailing list