From 95d742ebf4d5bd7ff3bf55ea5bc43ced7240429f Mon Sep 17 00:00:00 2001 From: maxpohlmann Date: Thu, 29 Feb 2024 11:04:51 +0100 Subject: [PATCH] fix problem with non-exported function (#603) * fix problem with non-exported function * refactor (accept suggestion) --- lib/quantum.ex | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/lib/quantum.ex b/lib/quantum.ex index 12e9df8..aaca086 100644 --- a/lib/quantum.ex +++ b/lib/quantum.ex @@ -342,8 +342,11 @@ defmodule Quantum do defp duplicate_job?(existent_jobs, %Job{name: name}), do: Enum.member?(existent_jobs, name) defp invalid_job_task?(%Job{task: {m, f, args}}) - when is_atom(m) and is_atom(f) and is_list(args), - do: not function_exported?(m, f, length(args)) + when is_atom(m) and is_atom(f) and is_list(args) do + if Code.ensure_loaded?(m), + do: not function_exported?(m, f, length(args)), + else: true + end defp invalid_job_task?(_), do: false