Skip to content

Commit eaebb19

Browse files
committed
fix: Allow MFA tuple to be given sanitizer config
1 parent 62845ac commit eaebb19

File tree

3 files changed

+16
-3
lines changed

3 files changed

+16
-3
lines changed

CHANGELOG.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,12 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
66

77
## [Unreleased]
88

9+
## [0.7.1] - 2020-01-23
10+
11+
### Fixes
12+
13+
- Allow MFA tuple to be given to sanitizer config
14+
915
## [0.7.0] - 2020-01-22
1016

1117
### Added

VERSION

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
0.7.0
1+
0.7.1

lib/job.ex

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ defmodule EctoJobScheduler.Job do
2525
{context, params} = Map.pop(params, "context", %{})
2626

2727
job_context = %{
28-
"params" => params |> sanitizer().(),
28+
"params" => sanitize(params),
2929
"attempt" => attempt,
3030
"max_attempts" => max_attempts
3131
}
@@ -88,10 +88,17 @@ defmodule EctoJobScheduler.Job do
8888
end
8989
end
9090

91-
def sanitizer do
91+
defp sanitizer do
9292
Application.get_env(:ecto_job_scheduler, :sanitizer, fn param -> param end)
9393
end
9494

95+
defp sanitize(params) do
96+
case sanitizer() do
97+
fun when is_function(fun) -> fun.(params)
98+
{mod, fun_name} -> apply(mod, fun_name, [params])
99+
end
100+
end
101+
95102
def config do
96103
merged_options =
97104
@default_options

0 commit comments

Comments
 (0)