dis+/node_modules/@google-cloud/pubsub/build/src/publisher/message-queues.js
/**
     * Adds a message to the queue.
     *
     * @param {PubsubMessage} message The message to publish.
     * @param {PublishCallback} callback The publish callback.
     */
Adds a message to the queue.
@param {PubsubMessage} message The message to publish.
@param {PublishCallback} callback The publish callback.
Adds a message to the queue . @param { PubsubMessage } message The message to publish . @param { PublishCallback } callback The publish callback .
add(message, callback) {
        if (!this.batch.canFit(message)) {
            this.publish();
        }
        this.batch.add(message, callback);
        if (this.batch.isFull()) {
            this.publish();
        }
        else if (!this.pending) {
            const { maxMilliseconds } = this.batchOptions;
            this.pending = setTimeout(() => this.publish(), maxMilliseconds);
        }
    }
add ( message , callback ) { if ( ! this . batch . canFit ( message ) ) { this . publish ( ) ; } this . batch . add ( message , callback ) ; if ( this . batch . isFull ( ) ) { this . publish ( ) ; } else if ( ! this . pending ) { const { maxMilliseconds } = this . batchOptions ; this . pending = setTimeout ( ( ) => this . publish ( ) , maxMilliseconds ) ; } }
Adds a message to the queue.
Adds a message to the queue .