mirror of
https://github.com/mudler/LocalAI.git
synced 2025-05-30 23:44:59 +00:00
feat(federation): do not allocate local services for load balancing (#3337)
* refactor: extract proxy into functions * feat(federation): do not allocate services, directly connect with libp2p Signed-off-by: Ettore Di Giacinto <mudler@localai.io> --------- Signed-off-by: Ettore Di Giacinto <mudler@localai.io>
This commit is contained in:
parent
bcd3c1deb2
commit
6d350ccce0
4 changed files with 96 additions and 109 deletions
|
@ -40,9 +40,9 @@ func (fs *FederatedServer) RandomServer() string {
|
|||
var tunnelAddresses []string
|
||||
for _, v := range GetAvailableNodes(fs.service) {
|
||||
if v.IsOnline() {
|
||||
tunnelAddresses = append(tunnelAddresses, v.TunnelAddress)
|
||||
tunnelAddresses = append(tunnelAddresses, v.ID)
|
||||
} else {
|
||||
delete(fs.requestTable, v.TunnelAddress) // make sure it's not tracked
|
||||
delete(fs.requestTable, v.ID) // make sure it's not tracked
|
||||
log.Info().Msgf("Node %s is offline", v.ID)
|
||||
}
|
||||
}
|
||||
|
@ -61,8 +61,8 @@ func (fs *FederatedServer) syncTableStatus() {
|
|||
|
||||
for _, v := range GetAvailableNodes(fs.service) {
|
||||
if v.IsOnline() {
|
||||
fs.ensureRecordExist(v.TunnelAddress)
|
||||
currentTunnels[v.TunnelAddress] = struct{}{}
|
||||
fs.ensureRecordExist(v.ID)
|
||||
currentTunnels[v.ID] = struct{}{}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue