Skip to content

Commit 2fa3f7e

Browse files
k-risterclaude
andcommitted
fix: add var declaration to prevent implicit global race condition
metric_data was assigned without var/let/const, creating an implicit global variable. Concurrent requests to /api/v1/metric-data could overwrite each other's data, returning wrong results. Add var to make it function-scoped. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
1 parent ced0adc commit 2fa3f7e

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

queries/cdmq/server.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1637,7 +1637,7 @@ app.post('/api/v1/metric-data', async (req, res) => {
16371637
error: resp['ret-msg']
16381638
});
16391639
}
1640-
metric_data = resp['data-sets'][0];
1640+
var metric_data = resp['data-sets'][0];
16411641

16421642
var labelCount = metric_data && metric_data.values ? Object.keys(metric_data.values).length : 0;
16431643
var elapsed = Date.now() - reqStart;

0 commit comments

Comments
 (0)