A GenServer is used to remove songs when the expiration period has passed based on the song creation date.
The expiration period can be configured when the GenServer is started in the application supervision tree, the Genserver
receives two arguments: count and interval.
For example, you can choose to have songs expire two months after their creation date by passing the count=2 and interval="month" arguments
Changes are ready! I created a new test to validate the song count after deleting expired songs.
I also removed some duplicate code and reused some functions.
A GenServer is used to remove songs when the expiration period has passed based on the song creation date. The expiration period can be configured when the GenServer is started in the application supervision tree, the Genserver receives two arguments:
count
andinterval
. For example, you can choose to have songs expire two months after their creation date by passing thecount=2
andinterval="month" arguments