Fixes + stable gateway ids
This commit is contained in:
@@ -107,9 +107,6 @@ func selectGateway(ctx context.Context, registry GatewayRegistry, rail model.Rai
|
||||
eligible := make([]*model.GatewayInstanceDescriptor, 0)
|
||||
var lastErr error
|
||||
for _, gw := range all {
|
||||
if instanceID != "" && !strings.EqualFold(strings.TrimSpace(gw.InstanceID), instanceID) {
|
||||
continue
|
||||
}
|
||||
if err := isGatewayEligible(gw, rail, network, currency, action, dir, amt); err != nil {
|
||||
lastErr = err
|
||||
continue
|
||||
@@ -125,6 +122,13 @@ func selectGateway(ctx context.Context, registry GatewayRegistry, rail model.Rai
|
||||
sort.Slice(eligible, func(i, j int) bool {
|
||||
return eligible[i].ID < eligible[j].ID
|
||||
})
|
||||
if instanceID != "" {
|
||||
for _, gw := range eligible {
|
||||
if strings.EqualFold(strings.TrimSpace(gw.InstanceID), instanceID) {
|
||||
return gw, nil
|
||||
}
|
||||
}
|
||||
}
|
||||
return eligible[0], nil
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user