dis+/node_modules/@google-cloud/pubsub/build/src/publisher/message-queues.js
/**
     * Publishes the messages. If successful it will prepare the next batch to be
     * published immediately after. If an error occurs, it will reject all
     * pending messages. In the event that no pending messages/batches are left,
     * a "drain" event will be fired, indicating to the publisher that it is
     * safe to delete this queue.
     *
     * @fires OrderedQueue#drain
     */
Publishes the messages. If successful it will prepare the next batch to be
published immediately after. If an error occurs, it will reject all
pending messages. In the event that no pending messages/batches are left,
a "drain" event will be fired, indicating to the publisher that it is
safe to delete this queue.


Publishes the messages . If successful it will prepare the next batch to be published immediately after . If an error occurs it will reject all pending messages . In the event that no pending messages / batches are left a " drain " event will be fired indicating to the publisher that it is safe to delete this queue .
publish(callback) {
        const definedCallback = callback || (() => { });
        this.inFlight = true;
        if (this.pending) {
            clearTimeout(this.pending);
            delete this.pending;
        }
        const { messages, callbacks } = this.batches.pop();
        this._publish(messages, callbacks, (err) => {
            this.inFlight = false;
            if (err) {
                this.handlePublishFailure(err);
                definedCallback(err);
            }
            else if (this.batches.length) {
                this.beginNextPublish();
            }
            else {
                this.emit('drain');
                definedCallback(null);
            }
        });
    }
publish ( callback ) { const definedCallback = callback || ( ( ) => { } ) ; this . inFlight = true ; if ( this . pending ) { clearTimeout ( this . pending ) ; delete this . pending ; } const { messages , callbacks } = this . batches . pop ( ) ; this . _publish ( messages , callbacks , ( err ) => { this . inFlight = false ; if ( err ) { this . handlePublishFailure ( err ) ; definedCallback ( err ) ; } else if ( this . batches . length ) { this . beginNextPublish ( ) ; } else { this . emit ( 'drain' ) ; definedCallback ( null ) ; } } ) ; }
Publishes the messages.
Publishes the messages .