refactor(membership-fees): fold cycle-generation run/0 into run/1
This commit is contained in:
parent
1b2b27368c
commit
9702f45e9a
1 changed files with 1 additions and 21 deletions
|
|
@ -59,27 +59,7 @@ defmodule Mv.MembershipFees.CycleGenerationJob do
|
||||||
|
|
||||||
"""
|
"""
|
||||||
@spec run() :: {:ok, CycleGenerator.results_summary()} | {:error, Ash.Error.t()}
|
@spec run() :: {:ok, CycleGenerator.results_summary()} | {:error, Ash.Error.t()}
|
||||||
def run do
|
def run, do: run([])
|
||||||
Logger.info("Starting membership fee cycle generation job")
|
|
||||||
start_time = System.monotonic_time(:millisecond)
|
|
||||||
|
|
||||||
result = CycleGenerator.generate_cycles_for_all_members()
|
|
||||||
|
|
||||||
elapsed = System.monotonic_time(:millisecond) - start_time
|
|
||||||
|
|
||||||
case result do
|
|
||||||
{:ok, stats} ->
|
|
||||||
Logger.info(
|
|
||||||
"Cycle generation completed in #{elapsed}ms: #{stats.success} success, #{stats.failed} failed, #{stats.total} total"
|
|
||||||
)
|
|
||||||
|
|
||||||
result
|
|
||||||
|
|
||||||
{:error, reason} ->
|
|
||||||
Logger.error("Cycle generation failed: #{inspect(reason)}")
|
|
||||||
result
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
@doc """
|
@doc """
|
||||||
Runs cycle generation with custom options.
|
Runs cycle generation with custom options.
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue