message: align HiloIdGenerator with Java impl
diff: @@ -45,14 +45,13 @@ export class HiloIdGenerator {
  }
  public async nextId(): Promise<number> {
  -
  - const getNextIdWithinRange = async (): Promise<number> => {
  + while (true) {
  // local range is not exhausted yet
  const range = this._range;
  let id = range.increment();
  if (id <= range.maxId) {
  - return Promise.resolve(id);
  + return id;
  }
  let acquiredSemContext: AcquiredSemaphoreContext;
  @@ -73,15 +72,12 @@ export class HiloIdGenerator {
  }
  await this._getNextRange();
  - return getNextIdWithinRange();
  } finally {
  if (acquiredSemContext) {
  acquiredSemContext.dispose();
  }
  }
  - };
  -
  - return getNextIdWithinRange();
  + }
  }
  public returnUnusedRange(): Promise<void> {
  @@ -91,7 +87,7 @@ export class HiloIdGenerator {
  return executor.execute(new HiloReturnCommand(this._tag, range.current, range.maxId));
  }
  - protected _getNextRange(): Promise<void> {
  + protected async _getNextRange(): Promise<void> {
  const hiloCmd = new NextHiloCommand(
  this._tag,
  this._lastBatchSize,
  @@ -99,8 +95,9 @@ export class HiloIdGenerator {
  this._identityPartsSeparator,
  this._range.maxId,
  this._store.conventions);
  - return this._store.getRequestExecutor(this._dbName).execute(hiloCmd)
  - .then(() => {
  +
  + await this._store.getRequestExecutor(this._dbName).execute(hiloCmd);
  +
  const result: HiLoResult = hiloCmd.result;
  this._prefix = result.prefix;
  this._lastBatchSize = result.lastSize;
  @@ -108,7 +105,6 @@ export class HiloIdGenerator {
  this._lastRangeAt = result.lastRangeAt;
  this._range = new HiloRangeValue(result.low, result.high);
  - });
  }
  protected _assembleDocumentId(currentRangeValue: number): string {
  