Coder Social home page Coder Social logo

Comments (12)

derekkraan avatar derekkraan commented on August 25, 2024 1

Let's start with linking to the project in the README?

from horde.

tyler-eon avatar tyler-eon commented on August 25, 2024 1

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.

sleipnir avatar sleipnir commented on August 25, 2024

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.

sleipnir avatar sleipnir commented on August 25, 2024

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.

tyler-eon avatar tyler-eon commented on August 25, 2024

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.

sleipnir avatar sleipnir commented on August 25, 2024

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.

If we had a reference to the PID somewhere in the api we wouldn't have to do the lookup

from horde.

caioaao avatar caioaao commented on August 25, 2024

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.

derekkraan avatar derekkraan commented on August 25, 2024

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.

caioaao avatar caioaao commented on August 25, 2024

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.

tyler-eon avatar tyler-eon commented on August 25, 2024

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.

sleipnir avatar sleipnir commented on August 25, 2024

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.

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.

caioaao avatar caioaao commented on August 25, 2024

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).

That I can do: #273

from horde.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.