@tiledesk/tiledesk-server 2.9.13 → 2.9.15

Sign up to get free protection for your applications and to get access to all the features.
@@ -46,29 +46,37 @@ connect(callback) {
46
46
  amqp.connect(this.url, function(err, conn) {
47
47
  if (err) {
48
48
  // if (this.debug) {console.log("[AMQP]", err.message);
49
- if (that.debug) {console.log("[JobWorker] AMQP", err);}
49
+ // if (that.debug) {console.log("[JobWorker] AMQP", err);}
50
+ console.error("[JobWorker] AMQP", err);
51
+ console.log("[JobWorker] Try to reconnect");
50
52
 
51
53
  return setTimeout(function() {
52
54
  that.connect()
53
55
  }, 1000);
54
56
  }
55
57
  conn.on("error", function(err) {
58
+ console.error("[JobWorker] err.message", err.message);
56
59
  if (err.message !== "Connection closing") {
57
- if (that.debug) {console.log("[JobWorker] AMQP conn error", err);}
60
+ //if (that.debug) {console.log("[JobWorker] AMQP conn error", err);}
61
+ console.log("[JobWorker] AMQP conn error", err)
62
+ if (callback) {
63
+ callback(null, err)
64
+ }
58
65
  }
59
66
  });
60
67
  conn.on("close", function() {
61
- if (that.debug) {console.log("[JobWorker] AMQP reconnecting");}
68
+ // if (that.debug) {console.log("[JobWorker] AMQP reconnecting");}
69
+ console.log("[JobWorker] AMQP reconnecting")
62
70
  return setTimeout(that.connect, 1000);
63
71
  });
64
72
 
65
- if (that.debug) {console.log("[JobWorker] AMQP connected");}
73
+ console.log("[JobWorker] AMQP connected")
66
74
  that.amqpConn = conn;
67
75
 
68
76
  // that.whenConnected(callback);
69
77
 
70
78
  if (callback) {
71
- callback();
79
+ callback('Connected', null);
72
80
  }
73
81
  // return resolve();
74
82
  // });
@@ -96,10 +104,12 @@ startPublisher(callback) {
96
104
  that.amqpConn.createConfirmChannel(function(err, ch) {
97
105
  if (that.closeOnErr(err)) return;
98
106
  ch.on("error", function(err) {
99
- if (that.debug) {console.log("[JobWorker] AMQP channel error", err);}
107
+ // if (that.debug) {console.log("[JobWorker] - startPublisher AMQP channel error", err);}
108
+ console.log("[JobWorker] - startPublisher AMQP channel error", err);
100
109
  });
101
110
  ch.on("close", function() {
102
- if (that.debug) {console.log("[JobWorker] AMQP channel closed");}
111
+ // if (that.debug) {console.log("[JobWorker] AMQP channel closed");}
112
+ console.log("[JobWorker] - startPublisher AMQP channel closed")
103
113
  });
104
114
 
105
115
  // if (this.debug) {console.log("[AMQP] pubChannel");