Commit 6a9e1eecdd843e6ec0c3f9bea992010797926e35

Authored by Adhidarma Hadiwinoto
1 parent 4af07f8fac
Exists in master

IS_DEBUG using var

Showing 1 changed file with 8 additions and 6 deletions Side-by-side Diff

  1 +const IS_DEBUG = process.env.KOMODO_SDK_DEBUG_PULL;
  2 +
1 3 const request = require('request');
2 4  
3 5 const config = require('../config');
... ... @@ -56,7 +58,7 @@ function setPartner(_partner) {
56 58  
57 59 function pullTask() {
58 60 if (isPaused()) {
59   - if (process.env.KOMODO_SDK_DEBUG_PULL) {
  61 + if (IS_DEBUG) {
60 62 logger.verbose('PULL TASK paused')
61 63 }
62 64 return;
... ... @@ -67,7 +69,7 @@ function pullTask() {
67 69 }
68 70  
69 71 if (!partner) {
70   - if (process.env.KOMODO_SDK_DEBUG_PULL) {
  72 + if (IS_DEBUG) {
71 73 logger.verbose('PULL TASK disabled because of undefined partner')
72 74 }
73 75  
... ... @@ -75,7 +77,7 @@ function pullTask() {
75 77 }
76 78  
77 79 if (matrix && matrix.not_ready) {
78   - if (process.env.KOMODO_SDK_DEBUG_PULL) {
  80 + if (IS_DEBUG) {
79 81 logger.verbose('PULL TASK paused because of gateway is not ready')
80 82 }
81 83 return;
... ... @@ -97,7 +99,7 @@ function pullTask() {
97 99  
98 100 //if (config.pulltask_mutex && pullTaskLocked) {
99 101 if (pullTaskLocked) {
100   - if (process.env.KOMODO_SDK_DEBUG_PULL) {
  102 + if (IS_DEBUG) {
101 103 logger.verbose('PULL TASK paused because LOCKED')
102 104 }
103 105 return;
... ... @@ -122,14 +124,14 @@ function pullTask() {
122 124  
123 125 if (config.pull_task_use_post) {
124 126 //logger.verbose('Requesting PULL-TASK to CORE using POST');
125   - if (process.env.KOMODO_SDK_DEBUG_PULL) {
  127 + if (IS_DEBUG) {
126 128 logger.verbose('PULL TASK using HTTP POST');
127 129 }
128 130 options.method = 'POST';
129 131 options.form = body_or_qs;
130 132 }
131 133 else {
132   - if (process.env.KOMODO_SDK_DEBUG_PULL) {
  134 + if (IS_DEBUG) {
133 135 logger.verbose('PULL TASK using HTTP GET');
134 136 }
135 137 options.method = 'GET';