Avoid to use "pubsub" for the name of modules, middlewares, variables, etc..
This commit is contained in:
@@ -2,16 +2,16 @@
|
||||
|
||||
const { PubSub } = require('@google-cloud/pubsub');
|
||||
|
||||
module.exports = class PubSubMetricsBackend {
|
||||
module.exports = class MetricsBackend {
|
||||
constructor (options = {}) {
|
||||
const { project_id: projectId, credentials: keyFilename, topic } = options;
|
||||
|
||||
this._pubsub = new PubSub({ projectId, keyFilename });
|
||||
this._metricsClient = new PubSub({ projectId, keyFilename });
|
||||
this._topicName = topic;
|
||||
}
|
||||
|
||||
send (event, attributes) {
|
||||
const data = Buffer.from(event);
|
||||
return this._pubsub.topic(this._topicName).publish(data, attributes);
|
||||
return this._metricsClient.topic(this._topicName).publish(data, attributes);
|
||||
}
|
||||
};
|
||||
Reference in New Issue
Block a user