diff --git a/src/meta/settings.js b/src/meta/settings.js index 5df3a2f8b9..e9ba356eba 100644 --- a/src/meta/settings.js +++ b/src/meta/settings.js @@ -69,16 +69,21 @@ Settings.set = async function (hash, values, quiet) { await db.deleteAll(deleteKeys); })); - const ops = []; + const sortedSetData = []; + const objectData = { keys: [], data: [] }; sortedLists.forEach((list) => { const arr = sortedListData[list]; arr.forEach((data, order) => { - ops.push(db.sortedSetAdd(`settings:${hash}:sorted-list:${list}`, order, order)); - ops.push(db.setObject(`settings:${hash}:sorted-list:${list}:${order}`, data)); + sortedSetData.push([`settings:${hash}:sorted-list:${list}`, order, order]); + objectData.keys.push(`settings:${hash}:sorted-list:${list}:${order}`); + objectData.data.push(data); }); }); - await Promise.all(ops); + await Promise.all([ + db.sortedSetAddBulk(sortedSetData), + db.setObjectBulk(objectData.keys, objectData.data), + ]); } if (Object.keys(values).length) {