Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- defmodule Phoenix.SchedulePost do
- use GenServer
- def start_link(state) do
- GenServer.start_link __MODULE__,state
- end
- def init(state) do
- schedule_post(state)
- {:ok, state}
- end
- #handling looby
- def handle_info(:postSchedule,state) do
- #sending posts to others
- {:noreply,state}
- end
- #scheduling a task
- defp schedule_post(state) do
- IO.puts "scheduling the task"
- Process.send_after(self(),:postSchedule,1*60*1000)
- end
- end
- Phoenix.SchedulePost.start_link(postId);
Add Comment
Please, Sign In to add comment