Skip to content

how to release node ID when a node exit unexpected. #280

@wenfengwang

Description

@wenfengwang

Enhancement

We introduced the new ID-generated algorithm in #276, but as code below:

func (sf *snowflake) RegisterNode(ctx context.Context, in *wrapperspb.UInt32Value) (*emptypb.Empty, error) {
	...

	id := uint16(in.Value)
	_, exist := sf.nodes[id]
	if exist {
		return nil, errors.New("node has been register")
	}
        ...

So If a node exit unexpectedly and does not unregister itself, the new one will not be able to register again, how to fix it?

Metadata

Metadata

Assignees

Labels

co/commonrelating to common code, like pkg or primitive

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions