Is this the only place you’re using the Foo gen server? If so, perhaps you don’t need to use a separate GenServer or process at all. Each job in Oban runs as an isolated process already.
This can work, you’d just need to call Process.flag(:trap_exit, true) within the Oban job to ensure that it receives an :EXIT, pid, reason message rather than crashing the process. By default Oban jobs do not trap exits.
Sending messages between processes will always add a little bit of complexity: passing pids, sending messages and monitoring are par for the course. If possible, I’d first try to put all of this within a single process. Failing that, I would try to use a Task rather than a GenServer and simplify the message passing.






















