mirror of
https://github.com/ash-project/ash_oban.git
synced 2024-09-19 12:53:34 +12:00
fix: don't schedule triggers with no scheduler
This commit is contained in:
parent
06c340569f
commit
c74eb9f8f5
1 changed files with 8 additions and 1 deletions
|
@ -8,6 +8,7 @@ defmodule AshOban.Test do
|
|||
|> Ash.Api.Info.resources()
|
||||
|> Enum.reduce(%{}, fn resource, acc ->
|
||||
resource
|
||||
|> IO.inspect()
|
||||
|> schedule_and_run_triggers()
|
||||
|> Map.merge(acc, fn _key, left, right ->
|
||||
left + right
|
||||
|
@ -16,7 +17,11 @@ defmodule AshOban.Test do
|
|||
|
||||
Spark.Dsl.is?(resource_or_api_or_otp_app, Ash.Resource) ->
|
||||
triggers =
|
||||
AshOban.Info.oban_triggers(resource_or_api_or_otp_app)
|
||||
resource_or_api_or_otp_app
|
||||
|> AshOban.Info.oban_triggers()
|
||||
|> Enum.filter(fn trigger ->
|
||||
trigger.scheduler
|
||||
end)
|
||||
|
||||
Enum.each(triggers, fn trigger ->
|
||||
AshOban.schedule(resource_or_api_or_otp_app, trigger)
|
||||
|
@ -41,6 +46,8 @@ defmodule AshOban.Test do
|
|||
|> Application.get_env(:ash_apis, [])
|
||||
|> List.wrap()
|
||||
|> Enum.reduce(%{}, fn api, acc ->
|
||||
IO.inspect(api)
|
||||
|
||||
api
|
||||
|> schedule_and_run_triggers()
|
||||
|> Map.merge(acc, fn _key, left, right ->
|
||||
|
|
Loading…
Reference in a new issue