lightableMatch / AMF

0 stars 0 forks source link

Define Behavior For Out Of Date Player Information #4

Open antoniopetrole opened 2 years ago

antoniopetrole commented 2 years ago

Background

Once the story below has been implemented, we need to decide on how to update out of date player information https://github.com/T1NKY-W1NKY/AMF/issues/3

Currently if someone uses our app to search for players, if the player exists it will pull the information from the database. However, this information never gets updated after the first search when it's populated from the API. This spike is to research solutions to updating out of date player information.

Assume the business requirement wants the player information to never be more than 1 day old.

Possible Solutions

  1. Add Spring Cron Job that runs every 1 day and loops through all of the rows in the database and rehydrates them
  2. Add field to player table that consists of a timestamp NOW() when the entry gets first populated, then in the service when you find the player, compared that populated time against todays NOW() and if it's greater than 1 day old, call the API.
  3. Come up with your own solutions

Outcome

A follow up story with the implementation decided on

Any other notes / resources to share?

lightableMatch commented 2 years ago

Solution number 1 was used: A Cron Job that refreshes players at the start of each day. (Currently the application does not run 24/7 so technically this solution is not perfect) -Look into refreshing players upon start of application perhaps to cover this.

lightableMatch commented 2 years ago

A problem I see is the Apex Legends API can only be accessed 2 times every second or vice versa so trying to update a large player base would likely require a subscription to their API