File tree Expand file tree Collapse file tree 1 file changed +23
-0
lines changed
Expand file tree Collapse file tree 1 file changed +23
-0
lines changed Original file line number Diff line number Diff line change 44 "context"
55 "fmt"
66 "io/ioutil"
7+ "sort"
78 "sync"
89 "time"
910
@@ -118,7 +119,29 @@ func (s *Manager) StartIntegratedServers(lndClient lnrpc.LightningClient,
118119 s .mu .Lock ()
119120 defer s .mu .Unlock ()
120121
122+ // Sort for deterministic startup: critical integrated sub-servers
123+ // first, then alphabetical to keep the order stable across runs.
124+ servers := make ([]* subServerWrapper , 0 , len (s .servers ))
121125 for _ , ss := range s .servers {
126+ servers = append (servers , ss )
127+ }
128+
129+ sort .Slice (servers , func (i , j int ) bool {
130+ iCritical := criticalIntegratedSubServers .Contains (
131+ servers [i ].Name (),
132+ )
133+ jCritical := criticalIntegratedSubServers .Contains (
134+ servers [j ].Name (),
135+ )
136+
137+ if iCritical != jCritical {
138+ return iCritical
139+ }
140+
141+ return servers [i ].Name () < servers [j ].Name ()
142+ })
143+
144+ for _ , ss := range servers {
122145 if ss .Remote () {
123146 continue
124147 }
You can’t perform that action at this time.
0 commit comments