mirror of
https://github.com/jambonz/sbc-sip-sidecar.git
synced 2025-12-19 04:27:46 +00:00
fixed Array.prototype.push.apply will throw Maximum call stack size exceeded (#119)
* fixed Array.prototype.push.apply will throw Maximum call stack size exceeded * fixed review comment
This commit is contained in:
@@ -223,11 +223,17 @@ const updateCarrierRegbots = async(logger, srf) => {
|
|||||||
|
|
||||||
debug('updateCarrierRegbots: got new or changed carriers');
|
debug('updateCarrierRegbots: got new or changed carriers');
|
||||||
logger.info({gws}, 'updateCarrierRegbots: got new or changed carriers');
|
logger.info({gws}, 'updateCarrierRegbots: got new or changed carriers');
|
||||||
|
|
||||||
|
// Clear and repopulate arrays in chunks to avoid argument limit
|
||||||
carriers.length = 0;
|
carriers.length = 0;
|
||||||
Array.prototype.push.apply(carriers, cs);
|
for (let i = 0; i < cs.length; i += 1000) {
|
||||||
|
Array.prototype.push.apply(carriers, cs.slice(i, i + 1000));
|
||||||
|
}
|
||||||
|
|
||||||
gateways.length = 0;
|
gateways.length = 0;
|
||||||
Array.prototype.push.apply(gateways, gws);
|
for (let i = 0; i < gws.length; i += 1000) {
|
||||||
|
Array.prototype.push.apply(gateways, gws.slice(i, i + 1000));
|
||||||
|
}
|
||||||
|
|
||||||
// stop / kill existing regbots
|
// stop / kill existing regbots
|
||||||
regbots.forEach((rb) => rb.stop(srf));
|
regbots.forEach((rb) => rb.stop(srf));
|
||||||
|
|||||||
2
package-lock.json
generated
2
package-lock.json
generated
@@ -31,7 +31,7 @@
|
|||||||
"tape": "^5.7.5"
|
"tape": "^5.7.5"
|
||||||
},
|
},
|
||||||
"engines": {
|
"engines": {
|
||||||
"node": ">= 18.0.0"
|
"node": ">= 20.0.0"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/@ampproject/remapping": {
|
"node_modules/@ampproject/remapping": {
|
||||||
|
|||||||
Reference in New Issue
Block a user