WiFi.hasCredentials() is blocking for 18 seconds


I have a WiFi setup process which from a user menu allows any existing credentials to be cleared. To test whether there are any credentials on the photon I am using WiFi.hasCredentials(). This works fine most of the time, however, if there are credentials on the photon but the device is not within range of the wi-fi (not wi-fi connected) then I am seeing a delay of approximately 18 seconds until the function returns an answer - the answer is correct. Is there anything that I can do to reduce this delay? Code snippet below:


Serial.printlnf("wifiSetupScreen after  bmpDraw     at %i ", millis());
int i = WiFi.hasCredentials()?13:0;                         //V124B
mainButtons(2, i, 3, 4); //V091H/V124B
Serial.printlnf("wifiSetupScreen after mainButtons()at %i ", millis());


Let me ping someone that might be able to help, @rickkas7 or @ParticleD are you able to assist?