Fixes and todo in tests

pull/645/head
kompotkot 2022-08-08 15:58:38 +00:00
rodzic 1c9ad614b0
commit 5f91861550
3 zmienionych plików z 4 dodań i 11 usunięć

Wyświetl plik

@ -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

Wyświetl plik

@ -1,3 +1,4 @@
// TODO(kompotkot): Re-write tests for client
package main
import (

Wyświetl plik

@ -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)