code: private void waitForDisabled(String distId) {
          long maxTime = 1800000; // 30 min
          long start = System.currentTimeMillis();
  
          boolean deployed = isDeployed(distId);
          while (!deployed) {
              if (System.currentTimeMillis() < start + maxTime) {
                  sleep(10000);
                  deployed = isDeployed(distId);
              } else {
                  String error = "Timeout Reached waiting for distribution to " +
                                 "be disabled. Please wait a few minutes and try again.";
                  throw new RuntimeException(error);
              }
          }
      }
docs: /*
  Wait for the distribution to be disabled
  Note that this can take up to 15 min