kopia lustrzana https://github.com/bugout-dev/moonstream
Fixes and todo in tests
rodzic
1c9ad614b0
commit
5f91861550
|
@ -1,7 +1,6 @@
|
|||
package main
|
||||
|
||||
import (
|
||||
"errors"
|
||||
"reflect"
|
||||
"sync"
|
||||
"time"
|
||||
|
@ -53,7 +52,7 @@ func CreateClientPools() {
|
|||
}
|
||||
|
||||
// Return client pool corresponding to provided blockchain
|
||||
func GetClientPool(blockchain string) (*ClientPool, error) {
|
||||
func GetClientPool(blockchain string) *ClientPool {
|
||||
var cpool *ClientPool
|
||||
for b := range configBlockchains {
|
||||
if b == blockchain {
|
||||
|
@ -61,10 +60,7 @@ func GetClientPool(blockchain string) (*ClientPool, error) {
|
|||
cpool = &c
|
||||
}
|
||||
}
|
||||
if len(cpool.Client) == 0 {
|
||||
return nil, errors.New("Unsupported blockchain provided")
|
||||
}
|
||||
return cpool, nil
|
||||
return cpool
|
||||
}
|
||||
|
||||
// Updates client last appeal to node
|
||||
|
|
|
@ -1,3 +1,4 @@
|
|||
// TODO(kompotkot): Re-write tests for client
|
||||
package main
|
||||
|
||||
import (
|
||||
|
|
|
@ -55,11 +55,7 @@ func lbHandler(w http.ResponseWriter, r *http.Request) {
|
|||
|
||||
// Chose one node
|
||||
var node *Node
|
||||
cpool, err := GetClientPool(blockchain)
|
||||
if err != nil {
|
||||
http.Error(w, fmt.Sprintf("Unacceptable blockchain provided %s", blockchain), http.StatusBadRequest)
|
||||
return
|
||||
}
|
||||
cpool := GetClientPool(blockchain)
|
||||
node = cpool.GetClientNode(currentClientAccess.AccessID)
|
||||
if node == nil {
|
||||
node = blockchainPool.GetNextNode(blockchain)
|
||||
|
|
Ładowanie…
Reference in New Issue