jbpm-wb
jbpm-wb copied to clipboard
[JBPM-10184] Build templates optimization
This change tries to avoid extra builds after a template is already build.
TODO: Still unsure if that could lead to errors if template is changed and new execution servers are registered
Add test on jbpm-wb-kie-server/jbpm-wb-kie-server-backend/src/test/java/org/jbpm/workbench/ks/integration/KieServerIntegrationServerTemplateTest.java
jenkins do fdb
ok to test
@albfan are you adding the required test? Please respond/add it until Friday EOD
I'm working on that test
jenkins retest this please
jenkins do fdb
any progress on updates after review @albfan ? Also @nmirasch could you review this too?
ping @albfan, are you on this PR remaining test?
I think I can describe now what is this case for:
Under openshift all kie server are under same location (replicas acts behind a smart router). If you start a kie server with 3 replicas you will have 3 exact request of onServerInstanceConnected. if serverInstancesById put is set after the build, you will get 3 builds.
Setting put first you filter that. Probably same behaviour as a smart router.
That probably will mark no available endpoints if some kie server is shutdown (while there're still 2 kie servers alive)
Let me check if we allow duplicates on loadbalancer, at least with smart router, if no this is not correctly handled
jenkins retest this
So this optimization is just a corner case to detect an ongoing task that will end on
protected void indexServerInstances(ServerTemplate serverTemplate) {
serverTemplate.getServerInstanceKeys().forEach(serverInstanceKey -> serverInstancesById.put(serverInstanceKey.getServerInstanceId(),
serverInstanceKey));
}
```
which just happens after all kjars are build, but that will ignore any possible error deploying the template
@gmunozfe I keep the current behaviour (put after build) probably unneeded if indexServerInstances
is reached, but if no build is triggered probably still needed. I think in case of error building this is wrong, but that's different story
@fjtirado I added a tentative property to deal with this corner case (repeated builds from same url) this can only happen with customer with kie servers under load balancer, and starting at same time several kie servers (like openshift does with replicas)
Still using this serverInstancesById
looks wrong, as probably what we want to detect is we already started a build for that (like a cache of ongoing builds) to allow all the detection of fails to continue