8. Context Refactor - abarr/remote GitHub Wiki

A quick check that everything is done on the GenServer requirements.

Requirments

As it stands, the updated list looks like this

  1. :remote app launches GenServer when the application starts - DONE
  2. Holds state %{max_number: :integer, timestamp: :etc_datetime} - DONE
  • :timestamp starts as nil and is updated each time someone queries the GenServer - DONE
  • :timestamp represents the last time someone queried the GenServer - DONE
  1. Every 60 seconds, the GenServer runs a job - DONE
  • The GenServer updates every user's points value with a random value between 0..100 - DONE
  • The Genserver updates :max_number in the state to a new random number between 0..100 - DONE
  1. The GenServer accepts a call to return Users with points greater than :max_number with a limit of 2 and the :timestamp from the previous call. - DONE

Now that the GenServer is working as expected and the requirements are complete. I am going to clean up the code a bit:

  • Add in some comments
  • Extract the business logic from the GenServer
  • Implement a Context API