I use ns_eval, which can be used to run a command in all interpreters.
Honestly, though, I don't fool around with packages much with
aolserver... I mostly have directories, and a proc that will
recursively go through them, starting at a given root. So if I have
modules/a
modules/b
modules/c/d
I can say
myloadproc modules
to reload them all or
myloadproc modules/b
to just reload module b, and so forth.
myloadproc gets the list of files and then does
ns_eval [list source $file]
on each.
John Buckman wrote:
What do the other aolserver programmers do to ask all the tcl interps
to reload, so that new code can be brought in without restarting the
server?
I have a technique (described below) but it's not bug-free, so I was
wondering what people recommended?
One possibility, would be to ask all the tcl interpreters to exit on
the next page request, so that a new thread and thus new tcl
interpreter is created, loading up the new libraries. I don't know
how to do that, though.
Currently, I have a namespaced global variable $reload::time that is
set to the time when the last "package forget/package require". was
run When I want to reload all interpreters, I set a nsv variable to
the current time, and a function registered as
ns_register_filter postauth GET /* mooch_reload_check
runs for every page, so that if the nsv's reload time is not the same
as the local interp's reload time, then I run:
foreach p [package names] {
package forget $p
}
This seems to mostly work, but some interpreters don't play nice.
Other suggestions.... ?
-john
--
AOLserver - http://www.aolserver.com/
To Remove yourself from this list, simply send an email to
<[EMAIL PROTECTED]> with the
body of "SIGNOFF AOLSERVER" in the email message. You can leave the
Subject: field of your email blank.
--
AOLserver - http://www.aolserver.com/
To Remove yourself from this list, simply send an email to <[EMAIL PROTECTED]>
with the
body of "SIGNOFF AOLSERVER" in the email message. You can leave the Subject:
field of your email blank.