I have been investigating intermittent Wifi issues. To investigate further I created a skecth that simply checks the WiFi.RSSI() in the loop() and prints on the serial it changes to > 0 and hen it changes back to normal.
I tried all three SYSTEM_MODE(AUTOMATIC, SEMI, MANUAL);
In manual mode the error 2 (timeout) occurs about every 1 or two hours and lasts up to 5 minutes, in the other modes this happens more often for the same duration. If I use Spark.connect(); then the issue occurs as if I was using SYSTEM_MODE(AUTOMATIC, SEMI,);
As a work around, I can use WiFi.disconnect(); WiFi.connect(); will make it restore the signal level to normal within a few seconds.
I was surprised that WiFi.off(); WiFi.on(); reset the core.