0

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

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

4

1 回答 1

2

您没有正确指定字段:

maxTasksDispatchedPerSecond需要 需要maxDispatchesPerSecond
maxConcurrentTasks需要maxConcurrentDispatches

于 2019-08-30T21:09:51.927 回答