Avoid re-initializing CFs for entities on scheduling config changes
This commit is contained in:
		
							parent
							
								
									eb36297b69
								
							
						
					
					
						commit
						8a92f22215
					
				@ -310,6 +310,7 @@ public class CalculatedFieldManagerMessageProcessor extends AbstractContextAware
 | 
				
			|||||||
                // Alternative approach would be to use any list but avoid modifications to the list (change the complete map value instead)
 | 
					                // Alternative approach would be to use any list but avoid modifications to the list (change the complete map value instead)
 | 
				
			||||||
                entityIdCalculatedFields.computeIfAbsent(cf.getEntityId(), id -> new CopyOnWriteArrayList<>()).add(cfCtx);
 | 
					                entityIdCalculatedFields.computeIfAbsent(cf.getEntityId(), id -> new CopyOnWriteArrayList<>()).add(cfCtx);
 | 
				
			||||||
                addLinks(cf);
 | 
					                addLinks(cf);
 | 
				
			||||||
 | 
					                scheduleDynamicArgumentsRefreshTaskForCfIfNeeded(cfCtx);
 | 
				
			||||||
                initCf(cfCtx, callback, false);
 | 
					                initCf(cfCtx, callback, false);
 | 
				
			||||||
            }
 | 
					            }
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
@ -342,6 +343,7 @@ public class CalculatedFieldManagerMessageProcessor extends AbstractContextAware
 | 
				
			|||||||
                boolean hasSchedulingConfigChanges = newCfCtx.hasSchedulingConfigChanges(oldCfCtx);
 | 
					                boolean hasSchedulingConfigChanges = newCfCtx.hasSchedulingConfigChanges(oldCfCtx);
 | 
				
			||||||
                if (hasSchedulingConfigChanges) {
 | 
					                if (hasSchedulingConfigChanges) {
 | 
				
			||||||
                    cancelCfDynamicArgumentsRefreshTaskIfExists(cfId, false);
 | 
					                    cancelCfDynamicArgumentsRefreshTaskIfExists(cfId, false);
 | 
				
			||||||
 | 
					                    scheduleDynamicArgumentsRefreshTaskForCfIfNeeded(newCfCtx);
 | 
				
			||||||
                }
 | 
					                }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
                List<CalculatedFieldCtx> newCfList = new CopyOnWriteArrayList<>();
 | 
					                List<CalculatedFieldCtx> newCfList = new CopyOnWriteArrayList<>();
 | 
				
			||||||
@ -365,7 +367,7 @@ public class CalculatedFieldManagerMessageProcessor extends AbstractContextAware
 | 
				
			|||||||
                // We use copy on write lists to safely pass the reference to another actor for the iteration.
 | 
					                // We use copy on write lists to safely pass the reference to another actor for the iteration.
 | 
				
			||||||
                // Alternative approach would be to use any list but avoid modifications to the list (change the complete map value instead)
 | 
					                // Alternative approach would be to use any list but avoid modifications to the list (change the complete map value instead)
 | 
				
			||||||
                var stateChanges = newCfCtx.hasStateChanges(oldCfCtx);
 | 
					                var stateChanges = newCfCtx.hasStateChanges(oldCfCtx);
 | 
				
			||||||
                if (stateChanges || newCfCtx.hasOtherSignificantChanges(oldCfCtx) || hasSchedulingConfigChanges) {
 | 
					                if (stateChanges || newCfCtx.hasOtherSignificantChanges(oldCfCtx)) {
 | 
				
			||||||
                    initCf(newCfCtx, callback, stateChanges);
 | 
					                    initCf(newCfCtx, callback, stateChanges);
 | 
				
			||||||
                } else {
 | 
					                } else {
 | 
				
			||||||
                    callback.onSuccess();
 | 
					                    callback.onSuccess();
 | 
				
			||||||
@ -476,7 +478,6 @@ public class CalculatedFieldManagerMessageProcessor extends AbstractContextAware
 | 
				
			|||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    private void initCf(CalculatedFieldCtx cfCtx, TbCallback callback, boolean forceStateReinit) {
 | 
					    private void initCf(CalculatedFieldCtx cfCtx, TbCallback callback, boolean forceStateReinit) {
 | 
				
			||||||
        scheduleDynamicArgumentsRefreshTaskForCfIfNeeded(cfCtx);
 | 
					 | 
				
			||||||
        applyToTargetCfEntityActors(cfCtx, callback, (id, cb) -> initCfForEntity(id, cfCtx, forceStateReinit, cb));
 | 
					        applyToTargetCfEntityActors(cfCtx, callback, (id, cb) -> initCfForEntity(id, cfCtx, forceStateReinit, cb));
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user