code: function createTimeoutPromise(task, timeoutMs, timeoutCancellable, processCancellable, context) {
    return Promises.delay(timeoutMs, timeoutCancellable).then(
      triggered => {
        if (triggered) {
          context.info(`Timed out while waiting for ${task.name}`);
          // Cancel/short-circuit the process tasks
          if (processCancellable && typeof processCancellable.cancel === 'function') {
            const completed = processCancellable.cancel();
            if (completed) {
              context.warn(`Timeout was triggered, but task ${task.name} process is also already completed!`);
              return false;
            }
          }
          const timeoutOpts = {overrideCompleted: false, overrideUnstarted: false, reverseAttempt: true};
          task.timeout(new TimeoutError(`Ran out of time to complete ${task.name}`), timeoutOpts, true);
        }
        return triggered;
      },
      err => {
        if (isInstanceOf(err, DelayCancelledError)) {
          // The timeout promise was cancelled, which means that the main completing promise must have completed and cancelled the timeout
          context.debug(`Timeout cancelled after ${task.name} completed - ${err.message}`);
          return false; // a DelayCancelledError will only be thrown if the timeout has NOT triggered
        } else {
          // The timeout promise rejected with an unexpected error!
          context.error(`Timeout failed with an unexpected error while waiting for ${task.name}`, err);
          throw err;
        }
      }
    );
  }
docs: Creates a promise that will timeout when the configured percentage or 90% (if not configured) of the remaining time
  in millis is reached, which will give us hopefully enough time to finalise at least some of our message processing
  before we run out of time to complete everything in this invocation.
  
  @param {Task} task - a task to be timed out if the timeout triggers
  @param {number} timeoutMs - the number of milliseconds to wait before timing out
  @param {Object|undefined|null} [timeoutCancellable] - an arbitrary object onto which a cancelTimeout method will be installed
  @param {Cancellable|Object} processCancellable - the cancellable, which can be used to cancel the normal process flow if/when the new timeout promise times out
  @param {StreamConsumerContext} context - the context to use
  @return {Promise.<boolean>} a promise to return true if the timeout is triggered or false if not