Long Term Photon Connection Stability

Any suggestions for some good watchdog code? Over here https://community.particle.io/t/my-photons-are-experiencing-inconsistent-wi-fi-connection-behavior/31647/15 I see this:

void checkWiFi() {
	IPAddress ip = WiFi.resolve("www.google.com");

	if (ip[0] == 0) {
		USBSerial1.printf("Resetting WiFi\n");	
		
		WiFi.off();
		delay(5000);
		WiFi.on();
		delay(1000);
		WiFi.connect();	
	}
}

Or is there some better way to do it?