Search code examples
node.jsgoogle-cloud-platformgoogle-cloud-tasks

Google Cloud Task Queue RateLimits config being ignored


We are creating a Google Cloud Tasks queue (v2beta3) with the rate limit config set however this rate limit config is being ignored and instead it uses Googles defaults:

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
    }
  }
});

With cloud_tasks_res returning:

[
  {
    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
]

As per the documentation how we've done it looks correct: https://googleapis.dev/nodejs/tasks/latest/v2beta3.CloudTasksClient.html#createQueue https://googleapis.dev/nodejs/tasks/latest/google.cloud.tasks.v2beta3.html#.RateLimits


Solution

  • You don't have the fields specified correctly:

    maxTasksDispatchedPerSecond needs to be maxDispatchesPerSecond
    maxConcurrentTasks needs to be maxConcurrentDispatches