Commit a246475168a4428796a6c4f0efcfbd9a87a2b896

Authored by Adhidarma Hadiwinoto
1 parent 13ccde1645
Exists in master

config.force_all_to_pending

Showing 2 changed files with 16 additions and 8 deletions Side-by-side Diff

... ... @@ -25,5 +25,6 @@
25 25 "control_panel": {
26 26 "listen_port": 27441
27 27 },
28   - "do_not_verbose_log_report": true
  28 + "do_not_verbose_log_report": true,
  29 + "force_all_to_pending": false
29 30 }
... ... @@ -12,6 +12,7 @@ const config = require('komodo-sdk/config');
12 12 const logger = require('komodo-sdk/logger');
13 13 const matrix = require('komodo-sdk/matrix');
14 14 const pull = require('komodo-sdk/gateway/pull');
  15 +const resendDelay = require('komodo-sdk/gateway/resend-delay');
15 16  
16 17 const st24 = require('./st24');
17 18  
... ... @@ -80,13 +81,6 @@ function _topUpRequest(task, isAdvice) {
80 81 }
81 82 });
82 83  
83   - if (rc === '68') {
84   - setTimeout(
85   - function() { advice(task); },
86   - 5 * 60 * 1000
87   - );
88   - }
89   -
90 84 return;
91 85 }
92 86  
... ... @@ -180,8 +174,21 @@ function report(data) {
180 174 return;
181 175 }
182 176  
  177 + if (config && config.force_all_to_pending) {
  178 + data.rc = '68';
  179 + }
  180 +
183 181 matrix.last_report_to_core = data;
184 182 pull.report(data);
  183 +
  184 + if (!resendDelay.isEnabled()) return;
  185 +
  186 + if (data.task && data.rc && data.rc === '68') {
  187 + resendDelay.register(data.task, advice);
  188 + }
  189 + else {
  190 + resendDelay.cancel(data.trx_id);
  191 + }
185 192 }
186 193  
187 194 exports.buy = buy;