async init()

in src/scaler/scaler-core/state.js [239:260]


  async init() {
    /** @type {StateData} */
    const data = {
      createdOn: this.now,
      updatedOn: this.now,
      lastScalingTimestamp: 0,
      lastScalingCompleteTimestamp: 0,
      scalingOperationId: null,
      scalingRequestedSize: null,
      scalingMethod: null,
      scalingPreviousSize: null,
    };
    await this.writeToSpanner(StateSpanner.convertToStorage(data));
    // Need to return storage-format data which uses Date objects
    return {
      createdOn: new Date(data.createdOn),
      updatedOn: new Date(data.updatedOn),
      lastScalingTimestamp: new Date(0),
      lastScalingCompleteTimestamp: new Date(0),
      scalingOperationId: null,
    };
  }