Last active
January 30, 2019 16:43
-
-
Save TylerPachal/3f84083a2b6aaef96d3280ac03499a0d to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def init(type) do | |
Logger.info("#{type} - init start") | |
state = %{ | |
type: type, | |
data: nil | |
} | |
Logger.info("#{type} - init end") | |
# Modified return value that will trigger the handle_continue callback | |
{:ok, state, {:continue, :more_init}} | |
end | |
# New callback | |
def handle_continue(:more_init, state) do | |
data = get_data(state.type) | |
updated_state = Map.put(state, :data, data) | |
{:noreply, updated_state} | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment