Skip to content

Commit 11fd5a3

Browse files
committed
Geyser config now supports multiple VMs
1 parent dea5273 commit 11fd5a3

2 files changed

Lines changed: 15 additions & 5 deletions

File tree

geyser/config.go

Lines changed: 14 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
package geyser
22

33
import (
4+
"context"
5+
"strings"
46
"time"
57

68
"github.com/code-payments/code-server/pkg/config"
@@ -22,8 +24,8 @@ const (
2224
ProgramUpdateQueueSizeConfigEnvName = envConfigPrefix + "PROGRAM_UPDATE_QUEUE_SIZE"
2325
defaultProgramUpdateQueueSize = 1_000_000
2426

25-
VmAccountConfigEnvName = envConfigPrefix + "VM_ACCOUNT"
26-
defaultVmAccount = ""
27+
VmAccountsConfigEnvName = envConfigPrefix + "VM_ACCOUNTS"
28+
defaultVmAccounts = ""
2729

2830
MemoryAccountBackupWorkerIntervalConfigEnvName = envConfigPrefix + "MEMORY_ACCOUNT_BACKUP_WORKER_INTERVAL"
2931
defaultMemoryAccountBackupWorkerInterval = time.Minute
@@ -36,7 +38,7 @@ type conf struct {
3638
programUpdateWorkerCount config.Uint64
3739
programUpdateQueueSize config.Uint64
3840

39-
vmAccount config.String
41+
vmAccounts config.String
4042

4143
memoryAccountBackkupWorkerInterval config.Duration
4244
}
@@ -54,9 +56,17 @@ func WithEnvConfigs() ConfigProvider {
5456
programUpdateWorkerCount: env.NewUint64Config(ProgramUpdateWorkerCountConfigEnvName, defaultProgramUpdateWorkerCount),
5557
programUpdateQueueSize: env.NewUint64Config(ProgramUpdateQueueSizeConfigEnvName, defaultProgramUpdateQueueSize),
5658

57-
vmAccount: env.NewStringConfig(VmAccountConfigEnvName, defaultVmAccount),
59+
vmAccounts: env.NewStringConfig(VmAccountsConfigEnvName, defaultVmAccounts),
5860

5961
memoryAccountBackkupWorkerInterval: env.NewDurationConfig(MemoryAccountBackupWorkerIntervalConfigEnvName, defaultMemoryAccountBackupWorkerInterval),
6062
}
6163
}
6264
}
65+
66+
func parseVmAccountsConfig(ctx context.Context, c *conf) []string {
67+
parts := strings.Split(c.vmAccounts.Get(ctx), ",")
68+
for i, part := range parts {
69+
parts[i] = strings.TrimSpace(part)
70+
}
71+
return parts
72+
}

geyser/handler.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ func initializeProgramAccountUpdateHandlers(conf *conf, solanaClient solana.Clie
3232
solanaClient,
3333
ramStore,
3434
conf.memoryAccountBackkupWorkerInterval.Get(ctx),
35-
conf.vmAccount.Get(ctx),
35+
parseVmAccountsConfig(ctx, conf)...,
3636
),
3737
}
3838
}

0 commit comments

Comments
 (0)