Solution to the memory usage problem caused by upsertMany in Nest.js
P粉787806024
P粉787806024 2023-08-15 23:04:41
0
1
608
<p>There is a scheduled task that is executed every 5 minutes when using upsertMany to insert a large amount of data. I found that the memory increases every time a task is executed and the GC cannot reclaim the memory. How can I solve this problem? </p> <p>Using nestjs, @mikro-orm/nestjs</p> <pre class="brush:php;toolbar:false;">this.emBi.upsertMany(SingleOrderSales, saveArry)</pre>
P粉787806024
P粉787806024

reply all(1)
P粉798010441

According to the official documentation https://mikro-orm.io/docs/entity-manager, it seems that you need to manually execute the refresh command after finishing the work with the entity manager (also don't forget to wait). In your case:

Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!