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

The Client behaviour can now be used with use #178

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

joshk
Copy link
Contributor

@joshk joshk commented Apr 25, 2024

This allows people to use the defaults and override the implementations they want without having to implement all of them.
The ClientTest no longer really makes sense, so I've removed it.
This does remove the function value checking that apply_wrap was doing, although I think its fair that this be a responsibility of people implementing the behaviour or overriding the default.

@joshk joshk force-pushed the a-better-approach-to-client-behaviour branch 3 times, most recently from d143a9f to 9c5fe75 Compare April 25, 2024 09:01
Comment on lines -247 to -250
catch
:error, reason -> {:error, reason}
:exit, reason -> {:exit, reason}
err -> err
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd actually say this is the feature of the client. Thw whole purpose here was to guard the user from doing stupid things that completely severe the connection to NervesHub and leave their device in a bricked state unable to get a remote update.

Switching to the use model makes sense, but I think we need to find a way to have this protection still. With the proposed changes, every direct call on the client in the socket has the potential to blow up and kill it

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nerves is smart with rollbacks to previous versions, would that not possibly help?

could we do the smart logic in the areas that the methods are called?

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nerves can be smart with rollbacks, but it's only default in bbb. Most systems need to implement that logic/behavior.

And yes, totally can do the smart logic in the areas. Sorry my comment wasn't totally clear but the intention was definitely "there was a reason we did this, so lets make sure we think of that reason where things are being called"

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

totally get cha

maybe everywhere one of these methods are called we wrap that call instead? we could call it trap_errors?

lib/nerves_hub_link/client.ex Outdated Show resolved Hide resolved
this allows for people to use the defaults, and override the implementations they want without having to implement all of them.
the `ClientTest` no longer really makes sense, so I've removed it
@joshk joshk force-pushed the a-better-approach-to-client-behaviour branch from 9c5fe75 to 3880ee2 Compare April 25, 2024 12:32
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.

2 participants