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

Make Robot a real OTP behaviour #61

Open
michalmuskala opened this issue Nov 19, 2016 · 4 comments
Open

Make Robot a real OTP behaviour #61

michalmuskala opened this issue Nov 19, 2016 · 4 comments
Projects
Milestone

Comments

@michalmuskala
Copy link

Currently the Hewdig.Robot module masquerades as a pseudo behaviour through macros and injection of code into the user's module. This has couple issues, most notably the robot cannot be started twice - for example with different adapters - to handle traffic from two different networks. This limitation prevents me from using the library in it's current shape.

The Hedwig.Robot should be made a real behaviour with API similar to GenServer or to the custom Connection behaviour. This would make the code more flexible for runtime changes and configuration. Limiting injecting code into user modules should also speed up compilation. It is generally discouraged to inject large amounts of code into user modules.

If you agree this would be beneficial I would be glad to work on this.

@scrogson
Copy link
Member

@michalmuskala - Yes I agree. I have thought about this many many times.

I appreciate your willingness to help, but this would be something I would prefer to do myself as I have been wanting to do for a while now.

I would definitely appreciate feedback though. Sound good?

@michalmuskala
Copy link
Author

I totally understand that. If you have some questions or code you'd like me to review, just ping me.

@scrogson
Copy link
Member

I sure will. Thanks for understanding.

I'm going to release v1.0.0 and then begin on this change for 2.0.

@scrogson scrogson added this to the v2.0.0 milestone Aug 18, 2017
@electricshaman
Copy link

I'd love to see this for 2.0 as well. I just ran into another issue that stems from this, where a race condition exists due to the global name registration being deferred until handle_connect in the Robot behavior. Ideally this would be in start_link but that function is part of the code being injected and can't be overridden. I'd even settle for init but it's also being injected.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
2.0.0
In Progress
Development

No branches or pull requests

3 participants