Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Name registration error returned if no available node #42

Merged

Conversation

slashdotdash
Copy link
Collaborator

@slashdotdash slashdotdash commented Sep 11, 2017

A call to Swarm.register_name/5 will return {:error, :no_node_available} when the configured distribution strategy returns :undefined as the node to host the named process. This indicates that there are too few nodes available to start a process.

This pull request simplifies the tracker process by removing the pending name registrations when the distribution strategy indicates there is no available node to host the process. This is only applicable when using the Swarm.Distribution.StaticQuorumRing strategy module.

Previously the register name call would block indefinitely until the process could be started (once a node became available). The amended behaviour is to return an error tagged tuple to indicate that registration has failed. The caller should handle retrying while waiting for the cluster to form. It also allows errors to be logged and monitored.

A call to `Tracker.track/5` will return an error tagged tuple when the ring strategy returns `:undefined` as the node to host a named process.
…ient is `nil`

Remove duplicated code that uses pattern matching on `from` to guard against nil. Use `Tracker.reply/2` helper function instead.
@slashdotdash slashdotdash force-pushed the feature/no_node_available branch 3 times, most recently from dd95458 to 9a6a352 Compare October 4, 2017 20:25
Reset `static_quorum_size` env setting after test run
@slashdotdash slashdotdash force-pushed the feature/no_node_available branch from 9a6a352 to 7484b1e Compare October 4, 2017 20:25
@slashdotdash slashdotdash merged commit 7a0d26f into bitwalker:master Oct 4, 2017
@slashdotdash slashdotdash deleted the feature/no_node_available branch October 4, 2017 20:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant