Skip to content

Commit 66f6bb1

Browse files
committed
make the interceptor profiler faster when no interception points are defined
1 parent 5a57421 commit 66f6bb1

File tree

1 file changed

+18
-9
lines changed

1 file changed

+18
-9
lines changed

aspects/InterceptorProfiler.cfc

Lines changed: 18 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -26,20 +26,21 @@ component implements="coldbox.system.aop.MethodInterceptor" accessors="true" {
2626
* The AOP method invocation
2727
*/
2828
any function invokeMethod( required invocation ){
29+
30+
// Quick exit check: If no included interceptions, just bail
31+
if( !arrayLen( variables.includedInterceptions ) ){
32+
return arguments.invocation.proceed();
33+
}
34+
35+
// Start target checks
2936
var targetArgs = arguments.invocation.getArgs();
3037

31-
// state
38+
// Get the state either by name or position
3239
if ( structKeyExists( targetArgs, "state" ) ) {
3340
var state = targetArgs.state;
34-
} else if ( structKeyExists( targetArgs, 1 ) ) {
41+
} else {
3542
var state = targetArgs[ 1 ];
3643
}
37-
// data
38-
if ( structKeyExists( targetArgs, "data" ) ) {
39-
var data = targetArgs.data;
40-
} else if ( structKeyExists( targetArgs, 2 ) ) {
41-
var data = targetArgs[ 2 ];
42-
}
4344

4445
// Do we need to profile it or not?
4546
if (
@@ -54,7 +55,15 @@ component implements="coldbox.system.aop.MethodInterceptor" accessors="true" {
5455
return arguments.invocation.proceed();
5556
}
5657

57-
var txName = "[Interception] #state#";
58+
// Build Transaction name
59+
var txName = "[Interception] #state#";
60+
61+
// Get intercept data by name or position
62+
if ( structKeyExists( targetArgs, "data" ) ) {
63+
var data = targetArgs.data;
64+
} else {
65+
var data = targetArgs[ 2 ];
66+
}
5867

5968
// Is this an entity interception? If so, log it to assist
6069
if( data.keyExists( "entity" ) ){

0 commit comments

Comments
 (0)