Feature request - Swarm.send_after/3
- Dominant language
- Elixir
- Stars
- 1.3k
- Forks
- 110
- PR merge metrics
- No merged PRs in 30d
Description
First off, thanks for the awesome library! Sure makes clustering easy when running kubernetes.
I ran into an issue today where I want to be able to send a message after some given time to a process that's registered with Swarm (using `Swarm.register_name/4`), but I want to look up the PID to send to through Swarm at the time that the message is sent, not at the time of calling `Process.send_after/4`, that way if the PID and node for that process changes between the time of calling `Process.send_after/4` and the end of the delay, the message is still sent and not dropped because the process doesn't exist.
I tried the following:
```elixir
Process.send_after(
{:via, :swarm, process_name(device_id)},
:do_a_thing,
@one_hour
)
```
But that `{:via, :swarm, name}` thing doesn't work for `Process.send_after/4` in the same way it does when registering a name for a process.
I'm probably going to build this on my own anyway since I need this functionality, but if you're interested in having this feature as part of Swarm, let me know and I'll gladly extract it so it can be pushed upstream.
Or, if I'm going about this all wrong and there's a smarter way to do this, just let me know!
Thanks again for the great library!
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.