liqd / adhocracy

Adhocracy is a policy drafting and decision making software for distributed groups and open institutions.
GNU Affero General Public License v3.0
150 stars 37 forks source link

Fix diazo rules path #882

Closed nidico closed 10 years ago

nidico commented 10 years ago

If the diazo rules path isn't forced to use the file protocol, diazo first tries to resolve the rules files (rules.xml, rules_notheme.xml, rules_header.xml etc.) from the Adhocracy server. As these paths do not exist, Adhocracy returns the /error/document page with status code 404 and Diazo then tries to find the file in the filesystem. In most themes this results in 4*2=8 unsuccessful calls to Adhocracy on system startup.

Therefore system startup performance is increased significantly on systems using diazo theming.

Note that this would finally fix the "No such instance: localhost, defaulting" warnings which were only silenced in 94c74831e3992af212ac2c59f7ad9ec947cd82ae.

xi commented 10 years ago

I could not reproduce the issue i.e. I could not trigger the debug messages described in 94c7483. Can you give more detailed information on how to trigger/where to find them?

nidico commented 10 years ago

These messages are not thrown anymore due to the changes in that commit, which basically just changes that Adhocracy no more tries to find the non-existing diazo paths in non-existant localhost subdomain, but in the global scope.

If you want to reproduce the issue, open an ipdb in InstanceDiscriminatorMiddleware.__call__ and look at environ['HTTP_HOST'] and environ['PATH_INFO']. You'll end up 9 times in this breakpoint.

xi commented 10 years ago

Ok, I can see the point. merging.