code: private void enforceTimeLimits()
      {
          for (T query : queries.values()) {
              if (query.isDone()) {
                  continue;
              }
              Duration queryMaxRunTime = getQueryMaxRunTime(query.getSession());
              Duration queryMaxExecutionTime = getQueryMaxExecutionTime(query.getSession());
              Optional<DateTime> executionStartTime = query.getExecutionStartTime();
              DateTime createTime = query.getCreateTime();
              if (executionStartTime.isPresent() && executionStartTime.get().plus(queryMaxExecutionTime.toMillis()).isBeforeNow()) {
                  query.fail(new PrestoException(EXCEEDED_TIME_LIMIT, "Query exceeded the maximum execution time limit of " + queryMaxExecutionTime));
              }
              if (createTime.plus(queryMaxRunTime.toMillis()).isBeforeNow()) {
                  query.fail(new PrestoException(EXCEEDED_TIME_LIMIT, "Query exceeded maximum time limit of " + queryMaxRunTime));
              }
          }
      }
docs: Enforce query max runtime/execution time limits