我遇到连接问题,它没有断开连接。我有一个包含3273个项目的数组,我正在映射列表并单独创建所有项目,但最后连接没有关闭,请帮助!!!!
function set_db(products_list) {
products_list.map(function(p) {
SupplierProduct.findOrCreate({
where: {
product_code: p.ProductCode
},
defaults: {
oem_numbers: p.OemNumbers,
description: p.Description,
description2: p.Description2,
weight: p.Weight,
normal_dealer_cost: p.NormalDealerCost,
suggested_sell_price: p.SuggestedSellPrice,
product_classification_code: p.ProductClassificationCode,
battery_type_or_page_yields: p.BatteryTypeOrPageYields,
also_fits: p.AlsoFits,
units: p.Units,
prod_url: p.ProdUrl
}
}).spread((product, created) => {
console.log(product);
}).catch((err) => {
console.log(err);
}).finally(() => sequelize.close());
});
}
功能结束后,连接不会关闭。