Comments (12)
Let's start with linking to the project in the README?
from horde.
Let's start with linking to the project in the README?
I'd go further and include some of their docs in the readme as well! Their explanation on the
init
stuff, plus the retries were the missing pieces for us (and we've been running horde in prod for nearly a year afaik)This is an open source project, PRs improving the documentation are welcome.
It feels a bit self-aggrandizing if I were to link my own project in your readme, but I will at least see if I can add to the documentation some of the pitfalls I ran into that shaped the direction of my init
function (especially the wait_for_init
stuff).
from horde.
https://github.com/tyler-eon/horde-process
This seems very useful, specially for initial adoption. It's a single file defining a behaviour + implementation. At the very least the documentation @tyler-eon wrote to their lib was very helpful in understanding issues we were having with Horde in production
I think we could have an api built into Horde this way. As long as this is completely optional I believe it is a good thing.
from horde.
Another important point would be to add an option for the call and cast functions, allowing you to bypass the lookup step. Sometimes it is interesting to take the risk and use other retry or failure handling mechanisms if the target process has not been completely synchronized in CRDT
from horde.
Another important point would be to add an option for the call and cast functions, allowing you to bypass the lookup step. Sometimes it is interesting to take the risk and use other retry or failure handling mechanisms if the target process has not been completely synchronized in CRDT
Always looking for feedback, thanks @sleipnir ! Quick question though, what do you mean by "bypass the lookup step"? Do you mean effectively calling GenServer.cast/call
directly? If you don't have a way to accurately construct a PID reference, you would need to use a via tuple. You could theoretically get that by calling MyProcess.via_tuple/1
and pass that as the server name argument in GenServer.cast/call
. However I'm not sure if that would give you any benefit because the via tuple references the Horde Registry, and so if it hasn't been added to the node-local process registry yet then it doesn't matter whether you use something like fetch/1
or try to call GenServer directly using via_tuple/1
.
Apologies if I've misunderstood the request.
from horde.
Always looking for feedback, thanks @sleipnir ! Quick question though, what do you mean by "bypass the lookup step"? Do you mean effectively calling
GenServer.cast/call
directly? If you don't have a way to accurately construct a PID reference, you would need to use a via tuple. You could theoretically get that by callingMyProcess.via_tuple/1
and pass that as the server name argument inGenServer.cast/call
. However I'm not sure if that would give you any benefit because the via tuple references the Horde Registry, and so if it hasn't been added to the node-local process registry yet then it doesn't matter whether you use something likefetch/1
or try to call GenServer directly usingvia_tuple/1
.Apologies if I've misunderstood the request.
If we had a reference to the PID somewhere in the api we wouldn't have to do the lookup
from horde.
Let's start with linking to the project in the README?
I'd go further and include some of their docs in the readme as well! Their explanation on the init
stuff, plus the retries were the missing pieces for us (and we've been running horde in prod for nearly a year afaik)
from horde.
Let's start with linking to the project in the README?
I'd go further and include some of their docs in the readme as well! Their explanation on the
init
stuff, plus the retries were the missing pieces for us (and we've been running horde in prod for nearly a year afaik)
This is an open source project, PRs improving the documentation are welcome.
from horde.
Let's start with linking to the project in the README?
I'd go further and include some of their docs in the readme as well! Their explanation on the
init
stuff, plus the retries were the missing pieces for us (and we've been running horde in prod for nearly a year afaik)This is an open source project, PRs improving the documentation are welcome.
I know (and I usually do), butI'll sit this one out and I'm just relaying an info I found useful exactly because I lack understanding of the lib's internals, quirks, etc, so I don't think I'm the best to update the docs, and I thought the maintainer would know best what to do with that info 🤷
from horde.
If we had a reference to the PID somewhere in the api we wouldn't have to do the lookup
Ah, I see. Well, you actually can skip the lookup and just use GenServer.call
and GenServer.cast
directly with the PID since a Horde Process is just a GenServer right now.
# Using a Horde Process might look like...
My.Horde.Process.call(identifier, {:foobar, args})
# But if you already have the PID, skip it and use GenServer directly
GenServer.call(pid, {:foobar, args})
In fact, if you look at the source for e.g. call!/3
, you'll see that it's just two lines of code: one to get the PID and one to invoke GenServer.call/3
. So if you already have the PID itself then yeah you can, and certainly should, skip using the helper functions.
from horde.
If we had a reference to the PID somewhere in the api we wouldn't have to do the lookup
Ah, I see. Well, you actually can skip the lookup and just use
GenServer.call
andGenServer.cast
directly with the PID since a Horde Process is just a GenServer right now.# Using a Horde Process might look like... My.Horde.Process.call(identifier, {:foobar, args}) # But if you already have the PID, skip it and use GenServer directly GenServer.call(pid, {:foobar, args})In fact, if you look at the source for e.g.
call!/3
, you'll see that it's just two lines of code: one to get the PID and one to invokeGenServer.call/3
. So if you already have the PID itself then yeah you can, and certainly should, skip using the helper functions.
I think I didn't explain my point well. What I wanted to say is that since you are providing an API, it should provide the means without having to resort directly to a lower-level API, in the case of GenServer.
See this example from the Spawn project:
https://github.com/eigr/spawn/blob/51222e6ca78377411674bfd64c98d165371df45f/spawn_sdk/spawn_sdk/lib/actor.ex#L100
Do you realize that the API itself deals with passing on the reference? It's just an example but it explains my point of view a little better, I think.
But I think this discussion could be moved to the library repository in question so as not to disturb this thread here on Horde.
from horde.
Let's start with linking to the project in the README?
I'd go further and include some of their docs in the readme as well! Their explanation on the
init
stuff, plus the retries were the missing pieces for us (and we've been running horde in prod for nearly a year afaik)This is an open source project, PRs improving the documentation are welcome.
It feels a bit self-aggrandizing if I were to link my own project in your readme, but I will at least see if I can add to the documentation some of the pitfalls I ran into that shaped the direction of my
init
function (especially thewait_for_init
stuff).
That I can do: #273
from horde.
Related Issues (20)
- DynamicSupervisor.start_child hangs on infinite timeout HOT 3
- Is it possible to start a Horde dynamic supervisor with a registered name? HOT 2
- match error when stopping a process HOT 1
- Stopping Child via Horde.DynamicSupervisor.terminate_child with via_tuple HOT 1
- Occasional Horde Registry Lookup Misses HOT 2
- GenServer.cast cant find process via {:via, Horde.Registry, ...} HOT 6
- race condition in name conflict in same registry process results in all processes losing HOT 20
- Default random node distribution strategy HOT 5
- Match error while doing process handoff in dynamic supervisor
- Use new PartitionSupervisor
- Timeouts and Crashes in the Cluster HOT 2
- Disappearing values from Horde.Registry after spawning more than two nodes. HOT 2
- Why we need to handle {:error, {:already_started, pid}} ? HOT 4
- SayHello GenServer never (re)started on `count3` node?
- uniform_random_distribution.ex not in deps 8.7 HOT 1
- Old child specs remain in Supervisor CRDT after process handoff
- Registry.lookup doesn't always return new item that was just registered HOT 13
- Example of How to Start Children like a Regular Supervisor
- [BUG]: Horde Supervisor behaves one_for_all no matter what HOT 8
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from horde.