Skip to content

Commit

Permalink
Merge pull request #1 from langgenius/fix/typo
Browse files Browse the repository at this point in the history
fix: typo for checking map item existence
  • Loading branch information
Yeuoly authored Sep 6, 2024
2 parents 944316b + caee1da commit d987e96
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion internal/cluster/node.go
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,7 @@ func (c *Cluster) FetchPluginAvailableNodesByHashedId(hashed_plugin_id string) (
if err != nil {
continue
}
if c.nodes.Exits(node_id) {
if c.nodes.Exists(node_id) {
nodes = append(nodes, node_id)
}
}
Expand Down
4 changes: 2 additions & 2 deletions internal/cluster/plugin.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ func (c *Cluster) RegisterPlugin(lifetime plugin_entities.PluginRuntimeTimeLifeI
return err
}

if c.plugins.Exits(identity.String()) {
if c.plugins.Exists(identity.String()) {
return errors.New("plugin has been registered")
}

Expand Down Expand Up @@ -123,7 +123,7 @@ func (c *Cluster) doPluginStateUpdate(lifetime *pluginLifeTime) error {
state_key := c.getPluginStateKey(c.id, hash_identity)

// check if the plugin has been removed
if !c.plugins.Exits(identity.String()) {
if !c.plugins.Exists(identity.String()) {
// remove state
err = c.removePluginState(c.id, hash_identity)
if err != nil {
Expand Down
2 changes: 1 addition & 1 deletion internal/utils/mapping/sync.go
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ func (m *Map[K, V]) Len() int {
return int(atomic.LoadInt32(&m.len))
}

func (m *Map[K, V]) Exits(key K) bool {
func (m *Map[K, V]) Exists(key K) bool {
_, ok := m.Load(key)
return ok
}

0 comments on commit d987e96

Please sign in to comment.