use log-helper fileScope, minor lint fix
[squeep-amqp-helper] / lib / base.js
index 87607daeb6e7c1402feb490c5a0fc5c513ea6f1a..0805d07dff2b4ccf4f30a03e404f8a1bb1eba0d7 100644 (file)
@@ -1,9 +1,9 @@
 'use strict';
 const amqp = require('amqplib');
 const { isFatalError: isFatalAMQPError } = require('amqplib/lib/connection');
-const common = require('./common');
+const { fileScope } = require('@squeep/log-helper');
 
-const _fileScope = common.fileScope(__filename);
+const _fileScope = fileScope(__filename);
 
 /**
  * Base class common to worker publisher and consumer, handling
@@ -25,7 +25,7 @@ class Base {
    */
   constructor(logger, options) {
     this.logger = logger;
-    this.options = Object.assign({
+    this.options = {
       url: undefined,
       name: 'messages',
       prefix: 'squeep',
@@ -35,14 +35,16 @@ class Base {
       queueType: 'quorum',
       retryDelayMs: 10000,
       prefetch: 1,
-    }, options);
-    this.options.socketOptions = Object.assign({
+      ...options,
+    };
+    this.options.socketOptions = {
       noDelay: undefined,
       timeout: undefined,
       keepAlive: undefined,
       keepAliveDelay: undefined,
       clientProperties: undefined,
-    }, options.socketOptions);
+      ...options.socketOptions,
+    };
 
     this.connection = undefined;
     this.channel = undefined;
@@ -50,7 +52,7 @@ class Base {
 
 
   /**
-   * Establish the necessary connections to the queue and lock services.
+   * Establish the necessary connections to the queue.
    */
   async connect() {
     const _scope = _fileScope('connect');