Commit e7f5d2a50dc9c561a293c20181937338346e968b
1 parent
b403448adb
Exists in
master
and in
1 other branch
active sending
Showing 2 changed files with 14 additions and 0 deletions Side-by-side Diff
lib/core-callback/sender.js
... | ... | @@ -101,6 +101,12 @@ const sender = async (data, xid, retry) => { |
101 | 101 | }); |
102 | 102 | |
103 | 103 | matrix.callback_sender.sent += 1; |
104 | + matrix.callback_sender.active_count += 1; | |
105 | + matrix.callback_sender.active_sending[xid] = { | |
106 | + ts: new Date(), | |
107 | + trxId: data.trx_id, | |
108 | + reverseUrl: data.reverse_url, | |
109 | + }; | |
104 | 110 | |
105 | 111 | if (isPostpaid) { |
106 | 112 | matrix.callback_sender.sent_using_post += 1; |
... | ... | @@ -121,6 +127,7 @@ const sender = async (data, xid, retry) => { |
121 | 127 | ts: new Date(), |
122 | 128 | eCode: e.code, |
123 | 129 | eMessage: e.message, |
130 | + trxId: data.trx_id, | |
124 | 131 | reverseUrl: data.reverse_url, |
125 | 132 | httpStatus: e.response && e.response.status, |
126 | 133 | responseBody: e.response && e.response.data, |
... | ... | @@ -145,6 +152,11 @@ const sender = async (data, xid, retry) => { |
145 | 152 | }); |
146 | 153 | sender(data, xid, (retry || 0) + 1); |
147 | 154 | } |
155 | + } finally { | |
156 | + matrix.callback_sender.active_count -= 1; | |
157 | + if (matrix.callback_sender.active_sending[xid]) { | |
158 | + delete matrix.callback_sender.active_sending[xid]; | |
159 | + } | |
148 | 160 | } |
149 | 161 | }; |
150 | 162 |