moleculerjs / moleculer

:rocket: Progressive microservices framework for Node.js
https://moleculer.services/
MIT License
6.17k stars 587 forks source link

Remove unnecessary clone in node update method #1274

Closed Ubitso closed 7 months ago

Ubitso commented 9 months ago

:memo: Description

We have a lot of instances of the app, with a bunch of services. When app starts it took too long(4 sec on average) of active node cpu workload. I've used the node debug to find a hot spot. That was a deepClone in update method of node.js. It might be not necessary to clone the object because it comes from transport and it isn't used after. I think current tests it has to be enough to prove that everything ok with the registry

:gem: Type of change

:vertical_traffic_light: How Has This Been Tested?

It has to be enough current tests of node-catalog

:checkered_flag: Checklist:

Ubitso commented 9 months ago

image

Ubitso commented 9 months ago

I've found cloneDeep was used to omit handler properties from services object. It breaks CBOR serializer e2e tests.

Ubitso commented 9 months ago

@icebob Can you look this PR, please?