Ver código fonte

Merge pull request #1 from langgenius/fix/typo

fix: typo for checking map item existence
Yeuoly 10 meses atrás
pai
commit
d987e9680d

+ 1 - 1
internal/cluster/node.go

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

+ 2 - 2
internal/cluster/plugin.go

@@ -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")
 	}
 
@@ -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 {

+ 1 - 1
internal/utils/mapping/sync.go

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