Compile XML processing regular expression only once.
Requests per second from ~95 to ~98 with a "standard" test.
This commit is contained in:
parent
570f55dbbd
commit
b9e29938e2
@ -38,7 +38,8 @@ module.exports = function(){
|
||||
req.params.processXML = function(req, xml, callback) {
|
||||
if ( req.dbuser ) {
|
||||
// Only edit XML when authenticated
|
||||
xml = xml.replace(/(<Parameter name="user"><!\[CDATA\[)[^\]]*(]]><\/Parameter>)/, "$1" + req.dbuser + "$2");
|
||||
if ( ! me.rx_dbuser ) me.rx_dbuser = /(<Parameter name="user"><!\[CDATA\[)[^\]]*(]]><\/Parameter>)/;
|
||||
xml = xml.replace(me.rx_dbuser, "$1" + req.dbuser + "$2");
|
||||
}
|
||||
callback(null, xml);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user