This isn't exactly the library's intended function, but it would be great to have a ready-made function for the host change handler. The function should periodically poll all specified hosts and determine the master and how far behind the replicas are. To avoid polling hosts too frequently, set a timeout during which all calls to the function will return data from the cache.