Skip to content

Commit 2af890c

Browse files
committed
Do not profile the id block fetching in the profiling db sql session factory
The DbIdGenerator fetches the next id block through the process engine command executor. When a command of another engine is profiled, the select of the id block was attributed to that command.
1 parent 082d4f9 commit 2af890c

1 file changed

Lines changed: 7 additions & 0 deletions

File tree

‎modules/flowable-engine/src/main/java/org/flowable/engine/test/profiler/ProfilingDbSqlSessionFactory.java‎

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,11 @@
1212
*/
1313
package org.flowable.engine.test.profiler;
1414

15+
import org.flowable.common.engine.impl.db.DbSqlSession;
1516
import org.flowable.common.engine.impl.db.DbSqlSessionFactory;
1617
import org.flowable.common.engine.impl.interceptor.CommandContext;
1718
import org.flowable.common.engine.impl.interceptor.Session;
19+
import org.flowable.engine.impl.cmd.GetNextIdBlockCmd;
1820
import org.flowable.engine.impl.util.CommandContextUtil;
1921

2022
/**
@@ -28,6 +30,11 @@ public ProfilingDbSqlSessionFactory(boolean usePrefixId) {
2830

2931
@Override
3032
public Session openSession(CommandContext commandContext) {
33+
if (commandContext.getCommand() instanceof GetNextIdBlockCmd) {
34+
// The id block can be fetched through a command executor that is not profiled,
35+
// its operations should not be attributed to the profiled command that needed the id
36+
return new DbSqlSession(this, CommandContextUtil.getEntityCache(commandContext));
37+
}
3138
return new ProfilingDbSqlSession(this, CommandContextUtil.getEntityCache(commandContext));
3239
}
3340
}

0 commit comments

Comments
 (0)