Skip to content

Commit

Permalink
mark mock engine always up
Browse files Browse the repository at this point in the history
  • Loading branch information
CMGS committed Feb 3, 2023
1 parent ef94eb4 commit 55e504a
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
5 changes: 4 additions & 1 deletion store/etcdv3/node.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ import (
"github.com/projecteru2/core/engine"
enginefactory "github.com/projecteru2/core/engine/factory"
"github.com/projecteru2/core/engine/fake"
"github.com/projecteru2/core/engine/mocks/fakeengine"
"github.com/projecteru2/core/log"
"github.com/projecteru2/core/types"
"github.com/projecteru2/core/utils"
Expand Down Expand Up @@ -319,7 +320,9 @@ func (m *Mercury) doGetNodes(ctx context.Context, kvs []*mvccpb.KeyValue, labels
node := node
_ = m.pool.Invoke(func() {
defer wg.Done()
if _, err := m.GetNodeStatus(ctx, node.Name); err != nil && !errors.Is(err, types.ErrInvaildCount) {
if strings.HasPrefix(node.Endpoint, fakeengine.PrefixKey) {
node.Available = true
} else if _, err := m.GetNodeStatus(ctx, node.Name); err != nil && !errors.Is(err, types.ErrInvaildCount) {
logger.Errorf(ctx, err, "failed to get node status of %+v", node.Name)
} else {
node.Available = err == nil
Expand Down
5 changes: 4 additions & 1 deletion store/redis/node.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ import (
"github.com/projecteru2/core/engine"
enginefactory "github.com/projecteru2/core/engine/factory"
"github.com/projecteru2/core/engine/fake"
"github.com/projecteru2/core/engine/mocks/fakeengine"
"github.com/projecteru2/core/log"
"github.com/projecteru2/core/types"
"github.com/projecteru2/core/utils"
Expand Down Expand Up @@ -302,7 +303,9 @@ func (r *Rediaron) doGetNodes(ctx context.Context, kvs map[string]string, labels
node := node
_ = r.pool.Invoke(func() {
defer wg.Done()
if _, err := r.GetNodeStatus(ctx, node.Name); err != nil && !errors.Is(err, types.ErrInvaildCount) {
if strings.HasPrefix(node.Endpoint, fakeengine.PrefixKey) {
node.Available = true
} else if _, err := r.GetNodeStatus(ctx, node.Name); err != nil && !errors.Is(err, types.ErrInvaildCount) {
logger.Errorf(ctx, err, "failed to get node status of %+v", node.Name)
} else {
node.Available = err == nil
Expand Down

0 comments on commit 55e504a

Please sign in to comment.