File tree Expand file tree Collapse file tree 4 files changed +7
-1
lines changed
Expand file tree Collapse file tree 4 files changed +7
-1
lines changed Original file line number Diff line number Diff line change @@ -123,6 +123,7 @@ defmodule CodeCorps.Accounts do
123123 |> Repo . update ( )
124124 end
125125
126+ @ spec upload_github_photo_async ( User . t ) :: User . t | Processor . result
126127 defp upload_github_photo_async ( % User { cloudinary_public_id: nil } = user ) do
127128 Processor . process ( fn -> upload_github_photo ( user ) end )
128129 end
Original file line number Diff line number Diff line change 11defmodule CodeCorps.Processor.Async do
22 @ behaviour CodeCorps.Processor
33
4+ @ spec process ( ( ( ) -> any ) ) :: { :ok , pid }
45 def process ( fun ) do
56 Task.Supervisor . start_child ( :background_processor , fn ->
67 apply ( fun , [ ] )
Original file line number Diff line number Diff line change 11defmodule CodeCorps.Processor do
22 @ processor Application . get_env ( :code_corps , :processor )
33
4- @ callback process ( fun :: ( ( ) -> any ) ) :: any
4+ @ type result :: { :ok , pid } | any
55
6+ @ callback process ( fun :: ( ( ) -> any ) ) :: result
7+
8+ @ spec process ( ( ( ) -> any ) ) :: result
69 def process ( fun ) do
710 @ processor . process ( fun )
811 end
Original file line number Diff line number Diff line change 11defmodule CodeCorps.Processor.Sync do
22 @ behaviour CodeCorps.Processor
33
4+ @ spec process ( ( ( ) -> any ) ) :: any
45 def process ( fun ) do
56 apply ( fun , [ ] )
67 end
You can’t perform that action at this time.
0 commit comments