Google Cloud Task Queue RateLimits 配置被忽略

Google Cloud Task Queue RateLimits config being ignored

我们正在创建一个设置了速率限制配置的 Google Cloud Tasks 队列 (v2beta3),但是此速率限制配置被忽略,而是使用 Googles 默认值:

cloud_tasks_res = await tasksClient.createQueue({
  parent: `projects/PROJECT-ID/locations/LOCATION`,
  queue: {
    name: `projects/PROJECT-ID/locations/LOCATION/queues/myqueue`,
    rateLimits: {
      maxTasksDispatchedPerSecond: 100,
      maxConcurrentTasks: 50
    },
    retryConfig: { 
      maxAttempts: 150,
      maxRetryDuration: { seconds: 0, nanos: 0 },
      minBackoff: { seconds: 15, nanos: 0 },
      maxBackoff: {  seconds: 43200, nanos: 0 },
      maxDoublings: 13
    }
  }
});

cloud_tasks_res返回:

[
  {
    name: `projects/PROJECT-ID/locations/LOCATION/queues/myqueue`,
    purgeTime: null,
    rateLimits: { 
      maxBurstSize: 100, 
      maxConcurrentDispatches: 1000, 
      maxDispatchesPerSecond: 500 
    },
    retryConfig: {
      maxAttempts: 150,
      maxBackoff: { nanos: 0, seconds: "43200" },
      maxDoublings: 13,
      maxRetryDuration: null,
      minBackoff: { nanos: 0, seconds: "15" }
    },
    stackdriverLoggingConfig: null,
    state: "RUNNING"
  },
  undefined,
  undefined
]

根据文档,我们的做法看起来是正确的: https://googleapis.dev/nodejs/tasks/latest/v2beta3.CloudTasksClient.html#createQueue https://googleapis.dev/nodejs/tasks/latest/google.cloud.tasks.v2beta3.html#.RateLimits

您没有正确指定字段:

maxTasksDispatchedPerSecond 需要 maxDispatchesPerSecond
maxConcurrentTasks 需要 maxConcurrentDispatches