#Run Oban jobs in not booted system [SOLVED]

6 messages ยท Page 1 of 1 (latest)

rapid seal
#

Hi guys, I am trying to use Oban to queue jobs that send emails from a code that is run in task runner.

Sample code:

Ecto.Migrator.with_repo(MySystem.Repo, fn repo ->
  Application.ensure_all_started(:oban)

  Oban.start_link(repo: repo, engine: Oban.Pro.Engines.Smart, queues: [email: 10])

  send_emails()
end)

I'm getting runtime error: (RuntimeError) could not lookup Ecto repo MySystem.Repo because it was not started or it does not exist

Any tips or help would be really appreciated. ๐Ÿ™๐Ÿป

Thank you!

safe obsidian
rapid seal
#

Thank you for answering @safe obsidian ๐Ÿ™‡

even though I already used the MySystem.Repo in the migrator?

safe obsidian
#

with_repo/2 is made for runnin migrations usually

rapid seal
#

It makes sense now. Thank you @safe obsidian ๐Ÿ™‡