Cache Petri net functions after import#413
Conversation
Added a call to cache all Petri net functions immediately after importing a Petri net. This ensures that all relevant functions are available and improves the runtime performance for subsequent operations.
WalkthroughA call to cache all PetriNet functions is added to PetriNetService, executing immediately after successfully importing and saving a Petri net. This ensures cached functions are refreshed during the import process. Changes
Estimated code review effort🎯 2 (Simple) | ⏱️ ~8 minutes Possibly related PRs
Suggested labels
🚥 Pre-merge checks | ✅ 2 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (2 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Actionable comments posted: 0
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (1)
application-engine/src/main/java/com/netgrif/application/engine/petrinet/service/PetriNetService.java (1)
192-202: 🧹 Nitpick | 🔵 TrivialAvoid a full cache rebuild before the net is persisted
cacheAllPetriNetFunctions()runs beforedoSaveInternal, so if it rebuilds from the repository it won’t include the just-imported net; you already cache the new net at Line 202. This makes the new call redundant and potentially expensive on every import. Consider moving it after the save (or drop it ifcachePetriNetFunctionsis sufficient).Suggested move
- functionCacheService.cacheAllPetriNetFunctions(); runActionAndPublishEvent(outcome, null, newProcess.getPreUploadActions(), importPetriNetParams.getParams(), new ProcessDeployEvent(outcome, EventPhase.PRE)); @@ Optional<PetriNet> saveProcessOpt = doSaveInternal(newProcess); functionCacheService.cachePetriNetFunctions(newProcess); + functionCacheService.cacheAllPetriNetFunctions();
Added a call to cache all Petri net functions immediately after importing a Petri net. This ensures that all relevant functions are available and improves the runtime performance for subsequent operations.
Description
<Fixes [JIRA-ISSUE]>/<Implements [JIRA-ISSUE]>
Dependencies
Third party dependencies
Blocking Pull requests
<Depends on #(PR id)>/
How Has Been This Tested?
Test Configuration
<Please describe configuration for tests to run if applicable, like program parameters, host OS, VM configuration etc.>
Checklist:
Summary by CodeRabbit