GoogleCloudPlatform/gcloud-node — pull request #223 by jkingyens (2014-09-18 07:44:34+00:00)
Title: use array instead of event emitter for queuing requests

use a node.js array to queue up pending callbacks when requests are made before the token is fetched. The current mechanism uses an event emitter to add listeners, which can cause warnings when there is a buildup of requests during the initialization phase:

node) warning: possible EventEmitter memory leak detected. 11 listeners added. Use emitter.setMaxListeners() to increase limit.
Trace
at Connection.addListener (events.js:160:15)
at Connection.once (events.js:185:8)
at Connection.createAuthorizedReq (/Users/jkingyens/reach_system/node_modules/gcloud/lib/common/connection.js:272:8)
at Connection.req (/Users/jkingyens/reach_system/node_modules/gcloud/lib/common/connection.js:230:8)
at Bucket.makeReq_ (/Users/jkingyens/reach_system/node_modules/gcloud/lib/storage/index.js:572:19)
at Bucket.stat (/Users/jkingyens/reach_system/node_modules/gcloud/lib/storage/index.js:269:8)
at Bucket.createReadStream (/Users/jkingyens/reach_system/node_modules/gcloud/lib/storage/index.js:404:8)
at /Users/jkingyens/reach_system/Gruntfile.js:48:31
at /Users/jkingyens/reach_system/node_modules/async/lib/async.js:125:13
at Array.forEach (native)