Skip to content

Commit 4c09d1c

Browse files
authored
Add UploadNodes to control uploads more tightly (#559)
Creates a configurable list of nodes that will be used for uploads (as they are returned by health_check) Keeps existing health monitoring for all nodes, just filters at the end. A "smarter" method might be filtering _before_ tracking health, but this gets the job done for now. Opted to do the filtering outside of the monitor as it might be confusing why it only has a small number of nodes it thinks are "healthy". Notably still might be a footgun, as it's not obvious that health check would be limited to the UploadNodes
1 parent a25d8bf commit 4c09d1c

File tree

3 files changed

+25
-5
lines changed

3 files changed

+25
-5
lines changed

api/health_check.go

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ package api
22

33
import (
44
"context"
5+
"slices"
56

67
core_indexer "api.audius.co/indexer"
78
"connectrpc.com/connect"
@@ -64,11 +65,14 @@ func (app *ApiServer) healthCheck(c *fiber.Ctx) error {
6465

6566
healthyNodes := app.contentNodeMonitor.GetContentNodes()
6667
// Convert config.Node to contentNode
67-
contentNodes := make([]contentNode, len(healthyNodes))
68-
for i, node := range healthyNodes {
69-
contentNodes[i] = contentNode{
70-
DelegateOwnerWallet: node.DelegateOwnerWallet,
71-
Endpoint: node.Endpoint,
68+
contentNodes := make([]contentNode, 0, len(healthyNodes))
69+
for _, node := range healthyNodes {
70+
// icky reaching into config to check upload nodes
71+
if slices.Contains(app.contentNodeMonitor.config.UploadNodes, node.Endpoint) {
72+
contentNodes = append(contentNodes, contentNode{
73+
DelegateOwnerWallet: node.DelegateOwnerWallet,
74+
Endpoint: node.Endpoint,
75+
})
7276
}
7377
}
7478

config/config.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ type Config struct {
2727
ArtistCoinRewardsStaticSenders []Node
2828
StoreAllNodes []string
2929
DeadNodes []string
30+
UploadNodes []string
3031
VerifierAddress string
3132
DelegatePrivateKey string
3233
AxiomToken string
@@ -106,6 +107,7 @@ func init() {
106107
Cfg.SolanaIndexerWorkers = 1
107108
Cfg.DeadNodes = []string{}
108109
Cfg.StoreAllNodes = []string{}
110+
Cfg.UploadNodes = DevUploadNodes
109111
Cfg.AudiusdChainID = core_config.DevAcdcChainID
110112
Cfg.AudiusdEntityManagerAddress = core_config.DevAcdcAddress
111113
Cfg.AudiusAppUrl = "http://localhost:3000"
@@ -124,6 +126,7 @@ func init() {
124126
Cfg.Nodes = StageNodes
125127
Cfg.DeadNodes = []string{}
126128
Cfg.StoreAllNodes = []string{}
129+
Cfg.UploadNodes = StageUploadNodes
127130
Cfg.Rewards = core_config.MakeRewards(core_config.StageClaimAuthorities, core_config.StageRewardExtensions)
128131
Cfg.AudiusdURL = "creatornode11.staging.audius.co"
129132
Cfg.ChainId = "audius-testnet-alpha"
@@ -169,6 +172,7 @@ func init() {
169172
Cfg.StoreAllNodes = []string{
170173
"https://creatornode2.audius.co",
171174
}
175+
Cfg.UploadNodes = ProdUploadNodes
172176
Cfg.Rewards = core_config.MakeRewards(core_config.ProdClaimAuthorities, core_config.ProdRewardExtensions)
173177
Cfg.AudiusdURL = "creatornode.audius.co"
174178
Cfg.ChainId = "audius-mainnet-alpha-beta"

config/nodes.go

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -184,4 +184,16 @@ var (
184184
OwnerWallet: "0xCBB025e7933FADfc7C830AE520Fb2FD6D28c1065",
185185
},
186186
}
187+
188+
ProdUploadNodes = []string{
189+
"https://creatornode.audius.co",
190+
"https://creatornode2.audius.co",
191+
"https://creatornode3.audius.co",
192+
}
193+
StageUploadNodes = []string{
194+
"https://creatornode6.staging.audius.co",
195+
}
196+
DevUploadNodes = []string{
197+
"http://audius-creator-node-1",
198+
}
187199
)

0 commit comments

Comments
 (0)