Commit 05dc9e8bca60664a07de565e326032c51c22ec76
1 parent
69b18c7f0e
Exists in
master
More debug
Showing 1 changed file with 17 additions and 12 deletions Side-by-side Diff
lib/webservice/router/priceplan.js
... | ... | @@ -108,12 +108,14 @@ function lookupCorrectPriceplan(storeId, originStoreId, recursiveLevel = 0) { |
108 | 108 | recursiveLevel, |
109 | 109 | }; |
110 | 110 | |
111 | - logger.verbose('PRICEPLAN.lookupCorrectPriceplan: Got suitable result', { | |
112 | - storeId, | |
113 | - originStoreId, | |
114 | - priceplanName: data.priceplan_name, | |
115 | - recursiveLevel, | |
116 | - }); | |
111 | + if (DEBUG) { | |
112 | + logger.verbose('PRICEPLAN.lookupCorrectPriceplan: Got suitable result', { | |
113 | + storeId, | |
114 | + originStoreId, | |
115 | + priceplanName: data.priceplan_name, | |
116 | + recursiveLevel, | |
117 | + }); | |
118 | + } | |
117 | 119 | |
118 | 120 | resolve({ |
119 | 121 | priceplan: data.priceplan_name, |
... | ... | @@ -126,6 +128,8 @@ function lookupCorrectPriceplan(storeId, originStoreId, recursiveLevel = 0) { |
126 | 128 | async function pageShouldBe(req, res) { |
127 | 129 | if (!req.body) req.body = {}; |
128 | 130 | |
131 | + const startTime = new Date(); | |
132 | + | |
129 | 133 | const storeId = req.body.store_id || req.query.store_id; |
130 | 134 | if (!storeId) { |
131 | 135 | res.json({ |
... | ... | @@ -135,15 +139,16 @@ async function pageShouldBe(req, res) { |
135 | 139 | return; |
136 | 140 | } |
137 | 141 | |
138 | - if (DEBUG) { | |
139 | - logger.verbose('PRICEPLAN.pageShouldBe: Got a request', { | |
140 | - method: req.method, | |
141 | - storeId, | |
142 | - }); | |
143 | - } | |
142 | + logger.verbose('PRICEPLAN.pageShouldBe: Got a request', { | |
143 | + method: req.method, | |
144 | + storeId, | |
145 | + }); | |
144 | 146 | |
145 | 147 | const data = await lookupCorrectPriceplan(storeId, storeId, 0); |
146 | 148 | |
149 | + const deltaTime = Number(new Date() - startTime); | |
150 | + logger.info(`PRICEPLAN.pageShouldBe: Lookup finished ${deltaTime} ms`, { storeId }); | |
151 | + | |
147 | 152 | res.json({ |
148 | 153 | error: false, |
149 | 154 | error_message: null, |