Governance Bug Fxed. Calculations taking too long because of circular references with too many generations. Reduced to 3.

This commit is contained in:
Luis Fernando Molina committed 2021-09-22 18:42:28 +02:00
1 parent edb2f91006
commit d6c739b1c5
5 files changed
+30 -12

No files matched your search

@@ -1,10 +1,24 @@
function newGovernanceFunctionLibraryDistributionProcess() {
let thisObject = {
calculate: calculate
calculate: calculate,
finalize: finalize,
initialize: initialize
}
const DISTRIBUTION_PROCESS_RECALCULATION_DELAY = 5000
let loop
return thisObject
function initialize() {
loop = true
calculate()
}
function finalize() {
loop = false
}
function calculate() {
let pools = UI.projects.foundations.spaces.designSpace.workspace.getHierarchyHeadsByNodeType('Pools')
@@ -125,5 +139,9 @@ function newGovernanceFunctionLibraryDistributionProcess() {
UI.projects.governance.functionLibraries.tokenMining.calculate(
userProfiles
)
if (loop === true) {
setTimeout(calculate, DISTRIBUTION_PROCESS_RECALCULATION_DELAY)
}
}
}