Skip to content

Commit

Permalink
fix: added cap to heatmapData
Browse files Browse the repository at this point in the history
  • Loading branch information
tabarra committed Jan 16, 2023
1 parent 385dc4b commit 603f5aa
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
5 changes: 4 additions & 1 deletion core/components/StatsCollector/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ export default class StatsCollector {
const heatmapData = JSON.parse(rawFile);
if (!Array.isArray(heatmapData)) throw new Error('data is not an array');
if (!validatePerfCacheData(heatmapData)) throw new Error('invalid data in cache');
this.perfSeries = heatmapData;
this.perfSeries = heatmapData.slice(0, this.hardConfigs.performance.lengthCap);
} catch (error) {
logError(`Failed to load stats_heatmapData_v1 with message: ${error.message}`);
logError('Since this is not a critical file, it will be reset.');
Expand Down Expand Up @@ -182,6 +182,9 @@ export default class StatsCollector {

//Push to cache and save it
this.perfSeries.push(currSnapshot);
if (this.perfSeries.length > this.hardConfigs.performance.lengthCap){
this.perfSeries.shift();
}
try {
await fse.outputJSON(this.hardConfigs.heatmapDataFile, this.perfSeries);
if (verbose) {
Expand Down
2 changes: 1 addition & 1 deletion docs/dev_notes.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
- [x] guild roles
- [x] bot: update AGAIN to djs v14
- [x] fix `Restarting the fxserver with delay override 0.`
- [ ] add cap to `stats_heatmapData_v1.json` (StatsCollector.hardConfigs.performance.lengthCap)
- [x] add cap to `stats_heatmapData_v1.json` (StatsCollector.hardConfigs.performance.lengthCap)
- [ ] Remove approved table from whitelist page?
- [ ] the PR about hiding notifications
- [ ] merge translations
Expand Down

0 comments on commit 603f5aa

Please sign in to comment.