Index: openacs-4/packages/acs-tcl/tcl/site-nodes-procs.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/acs-tcl/tcl/site-nodes-procs.tcl,v diff -u -r1.54.2.2 -r1.54.2.3 --- openacs-4/packages/acs-tcl/tcl/site-nodes-procs.tcl 25 Mar 2004 18:36:05 -0000 1.54.2.2 +++ openacs-4/packages/acs-tcl/tcl/site-nodes-procs.tcl 15 Jun 2004 15:52:30 -0000 1.54.2.3 @@ -264,10 +264,6 @@ set url_by_node_id($node_id) $url if { ![empty_string_p $object_id] } { lappend url_by_object_id($object_id) $url - set url_by_object_id($object_id) [lsort \ - -decreasing \ - -command util::string_length_compare \ - $url_by_object_id($object_id)] } if { ![empty_string_p $package_key] } { lappend url_by_package_key($package_key) $url @@ -288,6 +284,18 @@ instance_name $instance_name package_type $package_type] } + # AG: This lsort used to live in the db_foreach loop above. I moved it here + # to avoid redundant re-sorting on systems where multiple URLs are mapped to + # the same object_id. This was causing a 40 minute startup delay on a .LRN site + # with 4000+ URLs mapped to one instance of the attachments package. + # The sort facilitates deleting child nodes before parent nodes. + foreach object_id [array names url_by_object_id] { + set url_by_object_id($object_id) [lsort \ + -decreasing \ + -command util::string_length_compare \ + $url_by_object_id($object_id)] + } + # update arrays nsv_array reset site_nodes [array get nodes] nsv_array reset site_node_url_by_node_id [array get url_by_node_id]