Skip to content

Commit 226bb1d

Browse files
authored
Merge pull request #2427 from SwarmboticsAI/fix-active-backup-selection
Fix active backup link selection
2 parents 8753829 + a0c3f43 commit 226bb1d

File tree

1 file changed

+5
-12
lines changed

1 file changed

+5
-12
lines changed

node/Bond.cpp

Lines changed: 5 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1750,19 +1750,12 @@ void Bond::processActiveBackupTasks(void* tPtr, int64_t now)
17501750
}
17511751
}
17521752
}
1753-
/*
17541753
// Sort queue based on performance
1755-
if (! _abFailoverQueue.empty()) {
1756-
for (int i = 0; i < _abFailoverQueue.size(); i++) {
1757-
int value_to_insert = _abFailoverQueue[i];
1758-
int hole_position = i;
1759-
while (hole_position > 0 && (_abFailoverQueue[hole_position - 1] > value_to_insert)) {
1760-
_abFailoverQueue[hole_position] = _abFailoverQueue[hole_position - 1];
1761-
hole_position = hole_position - 1;
1762-
}
1763-
_abFailoverQueue[hole_position] = value_to_insert;
1764-
}
1765-
}*/
1754+
std::sort(_abFailoverQueue.begin(), _abFailoverQueue.end(),
1755+
[this](const int a, const int b) {
1756+
// Sort by failover score in descending order (highest score first)
1757+
return _paths[a].failoverScore > _paths[b].failoverScore;
1758+
});
17661759

17671760
/**
17681761
* Short-circuit if we have no queued paths

0 commit comments

Comments
 (0)