Ash FrameworkAF
Ash Framework•8mo ago•
21 replies
ken-kost

Ash Oban trigger after action

@Rebecca Le continuing from ash oban channel;
getting back to this, I have
    update :my_action do
      set_attribute(:about_me, "Test")
    end

    update :update_about_me do
      accept [:about_me]
      change run_oban_trigger(:my_trigger)
    end

and
  oban do
    triggers do
      trigger :my_trigger do
        action :my_action
        worker_read_action :read
        scheduler_cron false
        worker_module_name MyApp.Accounts.User.AshOban.Worker.MyTrigger
      end
    end
  end

super simple, just figuring it out. But nothing happens when I run update_about_me function regarding oban trigger šŸ¤”
I was expecting that action my_action was run in an oban job.

MyApp.Accounts.User.update_about_me me, %{about_me: "I love judo"}
[debug] QUERY OK db=0.2ms queue=0.1ms idle=1116.7ms
begin []
↳ Ash.Actions.Update.Bulk.run/6, at: lib/ash/actions/update/bulk.ex:240
[debug] QUERY OK source="users" db=1.4ms
UPDATE "users" AS u0 SET "about_me" = $1 WHERE (u0."id"::uuid::uuid = $2::uuid::uuid) RETURNING u0."translations", u0."id", u0."email", u0."about_me" ["Something about me", "e5e821fb-43d9-4244-8072-ae5dea8efcf7"]
↳ AshPostgres.DataLayer.update_query/4, at: lib/data_layer.ex:1533
[debug] QUERY OK db=3.7ms
commit []
↳ Ash.Actions.Update.Bulk.run/6, at: lib/ash/actions/update/bulk.ex:240

Am I still missing something?
Was this page helpful?