Commit 790e11bfdd066d40e1cd7bbe28eb715c0194dcd2

Authored by Adhidarma Hadiwinoto
1 parent 73b3251b53
Exists in master

_initSameDayDupe

Showing 1 changed file with 11 additions and 7 deletions Side-by-side Diff

... ... @@ -70,6 +70,16 @@ function callbackReport(requestId, rc, message) {
70 70 aaa.callbackReportWithPushToMongoDb(requestId, rc, message);
71 71 }
72 72  
  73 +function _initSameDayDupe() {
  74 + logger.info('Initializing antiSameDayDupe');
  75 + antiSameDayDupe = new AntiSameDayDupe({
  76 + config: config,
  77 + logger: logger,
  78 + keyPrefix: 'otomax.',
  79 + redisClient: redisClient
  80 + });
  81 +}
  82 +
73 83 function topupRequest(task) {
74 84 if (!aaa.isTodayTrx(task)) {
75 85 logger.warn('Maaf, transaksi beda hari tidak dapat dilakukan');
... ... @@ -81,13 +91,7 @@ function topupRequest(task) {
81 91 aaa.insertTaskToMongoDb(task);
82 92  
83 93 if (!antiSameDayDupe) {
84   - logger.info('Initializing antiSameDayDupe');
85   - antiSameDayDupe = new AntiSameDayDupe({
86   - config: config,
87   - logger: logger,
88   - keyPrefix: 'otomax.',
89   - redisClient: redisClient
90   - });
  94 + _initSameDayDupe();
91 95 }
92 96 antiSameDayDupe.check(task, _topupRequest, onSameDayDupe, checkStatus);
93 97 }