Fix Memory Leak on Data Gathering when server TZ is behind UTC (#2332)
* Fix for timezones behind UTC (the previous code converted the date to one day before (in local time) then added a day, which resulted in the same day after converting back to UTC and thus generating an infinite loop) * Update changelog --------- Co-authored-by: Rafael Claudio <rafacla@github.com> Co-authored-by: Thomas <4159106+dtslvr@users.noreply.github.com>
This commit is contained in:
parent
54c5746d21
commit
e23bf62859
@ -5,6 +5,12 @@ All notable changes to this project will be documented in this file.
|
|||||||
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
|
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
|
||||||
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
||||||
|
|
||||||
|
## Unreleased
|
||||||
|
|
||||||
|
### Fixed
|
||||||
|
|
||||||
|
- Fixed a memory leak related to the server's timezone (behind UTC) in the data gathering
|
||||||
|
|
||||||
## 2.3.0 - 2023-09-17
|
## 2.3.0 - 2023-09-17
|
||||||
|
|
||||||
### Added
|
### Added
|
||||||
|
@ -13,6 +13,7 @@ import { Injectable, Logger } from '@nestjs/common';
|
|||||||
import { Prisma } from '@prisma/client';
|
import { Prisma } from '@prisma/client';
|
||||||
import { Job } from 'bull';
|
import { Job } from 'bull';
|
||||||
import {
|
import {
|
||||||
|
addDays,
|
||||||
format,
|
format,
|
||||||
getDate,
|
getDate,
|
||||||
getMonth,
|
getMonth,
|
||||||
@ -101,15 +102,7 @@ export class DataGatheringProcessor {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
// Count month one up for iteration
|
currentDate = addDays(currentDate, 1);
|
||||||
currentDate = new Date(
|
|
||||||
Date.UTC(
|
|
||||||
getYear(currentDate),
|
|
||||||
getMonth(currentDate),
|
|
||||||
getDate(currentDate) + 1,
|
|
||||||
0
|
|
||||||
)
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
await this.marketDataService.updateMany({ data });
|
await this.marketDataService.updateMany({ data });
|
||||||
|
Loading…
x
Reference in New Issue
Block a user