Commit a224941f87746d7b8f2c28d65920290c81a47d5b

Authored by Adhidarma Hadiwinoto
1 parent 01ac204b0d
Exists in master

perbaikan resend

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

... ... @@ -189,24 +189,31 @@ function report(data) {
189 189 matrix.last_report_to_core = data;
190 190 pull.report(data);
191 191  
192   - if (!data.misc && !data.misc.task) {
  192 + if (!resendDelay.isEnabled()) {
  193 + //logger.verbose('Skipping resend delay because resend delay has not configured yet', {trx_id: task.trx_id, destination: task.destination, product: task.product});
193 194 return;
194 195 }
195 196  
196   - const task = data.misc.task;
  197 + if (data.rc !== '68') {
  198 + logger.verbose('Canceling resend delay', {trx_id: data.trx_id})
  199 + resendDelay.cancel(data.trx_id);
  200 + return;
  201 + }
197 202  
198   - if (!resendDelay.isEnabled()) {
199   - //logger.verbose('Skipping resend delay because resend delay has not configured yet', {trx_id: task.trx_id, destination: task.destination, product: task.product});
  203 +
  204 + if (!data.misc || !data.misc.task || typeof data.misc.task !== 'object') {
200 205 return;
201 206 }
202 207  
  208 + const task = data.misc.task;
  209 +
  210 +
203 211 if (data.rc && data.rc === '68') {
204 212 logger.verbose('Registering resend delay', {trx_id: task.trx_id, destination: task.destination, product: task.product})
205 213 resendDelay.register(task, advice);
206 214 }
207 215 else {
208   - logger.verbose('Canceling resend delay', {trx_id: task.trx_id, destination: task.destination, product: task.product})
209   - resendDelay.cancel(task.trx_id);
  216 +
210 217 }
211 218 }
212 219