Monitoring a reed switch - odd delay?

  uint32_t startMillis = millis();
  while (millis() - startMillis < 5000){
  }

This is dumb. Just use delay() if you are going to do nothing.

  Particle.subscribe(DEVICE_NAME, eventHandler, MY_DEVICES);

What board are you running this code on?