server: Add a GarbageCollection
The main idea is straightforward, every 1 minute (GC_EVERY
), list:
- if there is more than 10 unused instances (
GC_AFTER_UNUSED_INSTANCES
), take the 10 least recently used instances and shutdown them. - otherwise, check every unused instance and if it's hasn't been used for 24 hours, it's shutdowned.
The criterias to consider a webapp unused is if no one is connected. “Strategic” handlers are added in ServerApp.scala