Skip to content

Commit

Permalink
Update Worker: add comment to explain @service vs service()
Browse files Browse the repository at this point in the history
This commit just adds more explanation to the code to explain the
reasoning of using runtime vs compile time definition of the service.
  • Loading branch information
ktec committed Jan 29, 2020
1 parent 1666a93 commit 3d78103
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions lib/example/worker.ex
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,9 @@ defmodule Example.Worker do

alias Example.DefaultService

# When using ElixirLS, defining the service at compile time will result in an
# error because ElixirLS always compiles using MIX_ENV=test which mean @service
# will always be set to MockService, which does not have `foo/0`
# @service Application.get_env(:example, :service, DefaultService)
# @service DefaultService

Expand Down

0 comments on commit 3d78103

Please sign in to comment.