Skip to content
Snippets Groups Projects
Unverified Commit fa6cc264 authored by Matiss Janis Aboltins's avatar Matiss Janis Aboltins Committed by GitHub
Browse files

:recycle: cleanup iterableTopologicalSort feature flag (#3262)

parent a1ca871b
No related branches found
No related tags found
No related merge requests found
...@@ -89,9 +89,6 @@ export function ExperimentalFeatures() { ...@@ -89,9 +89,6 @@ export function ExperimentalFeatures() {
Goal templates Goal templates
</FeatureToggle> </FeatureToggle>
<FeatureToggle flag="simpleFinSync">SimpleFIN sync</FeatureToggle> <FeatureToggle flag="simpleFinSync">SimpleFIN sync</FeatureToggle>
<FeatureToggle flag="iterableTopologicalSort">
Iterable topological sort budget
</FeatureToggle>
</View> </View>
) : ( ) : (
<Link <Link
......
...@@ -8,7 +8,6 @@ const DEFAULT_FEATURE_FLAG_STATE: Record<FeatureFlag, boolean> = { ...@@ -8,7 +8,6 @@ const DEFAULT_FEATURE_FLAG_STATE: Record<FeatureFlag, boolean> = {
goalTemplatesEnabled: false, goalTemplatesEnabled: false,
spendingReport: false, spendingReport: false,
simpleFinSync: false, simpleFinSync: false,
iterableTopologicalSort: true,
}; };
export function useFeatureFlag(name: FeatureFlag): boolean { export function useFeatureFlag(name: FeatureFlag): boolean {
......
import { getPrefs } from '../prefs';
// @ts-strict-ignore // @ts-strict-ignore
export function Graph() { export function Graph() {
const graph = { const graph = {
...@@ -81,42 +79,16 @@ export function Graph() { ...@@ -81,42 +79,16 @@ export function Graph() {
function topologicalSort(sourceNodes) { function topologicalSort(sourceNodes) {
const visited = new Set(); const visited = new Set();
const sorted = []; const sorted = [];
const prefs = getPrefs();
const iterableTopologicalSort =
prefs != null ? prefs['flags.iterableTopologicalSort'] : false;
sourceNodes.forEach(name => { sourceNodes.forEach(name => {
if (!visited.has(name)) { if (!visited.has(name)) {
if (iterableTopologicalSort) { topologicalSortIterable(name, visited, sorted);
topologicalSortIterable(name, visited, sorted);
} else {
topologicalSortUntil(name, visited, sorted, 0);
}
} }
}); });
return sorted; return sorted;
} }
function topologicalSortUntil(name, visited, sorted, level) {
visited.add(name);
if (level > 2500) {
console.error('Limit of recursions reached while sorting budget: 2500');
return;
}
const iter = adjacent(name).values();
let cur = iter.next();
while (!cur.done) {
if (!visited.has(cur.value)) {
topologicalSortUntil(cur.value, visited, sorted, level + 1);
}
cur = iter.next();
}
sorted.unshift(name);
}
function topologicalSortIterable(name, visited, sorted) { function topologicalSortIterable(name, visited, sorted) {
const stackTrace: StackItem[] = []; const stackTrace: StackItem[] = [];
......
...@@ -6,8 +6,7 @@ export type FeatureFlag = ...@@ -6,8 +6,7 @@ export type FeatureFlag =
| 'reportBudget' | 'reportBudget'
| 'goalTemplatesEnabled' | 'goalTemplatesEnabled'
| 'spendingReport' | 'spendingReport'
| 'simpleFinSync' | 'simpleFinSync';
| 'iterableTopologicalSort';
/** /**
* Cross-device preferences. These sync across devices when they are changed. * Cross-device preferences. These sync across devices when they are changed.
......
---
category: Maintenance
authors: [Matissjanis]
---
Cleanup `iterableTopologicalSort` feature flag.
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment