refactor: shorter meta.settings.get

isekai-main
Barış Soner Uşaklı 3 years ago
parent 51cbeccb08
commit 190532b3b4

@ -21,13 +21,10 @@ Settings.get = async function (hash) {
]); ]);
const values = data || {}; const values = data || {};
await Promise.all(sortedLists.map(async (list) => { await Promise.all(sortedLists.map(async (list) => {
const members = await db.getSortedSetRange(`settings:${hash}:sorted-list:${list}`, 0, -1) || []; const members = await db.getSortedSetRange(`settings:${hash}:sorted-list:${list}`, 0, -1);
const keys = []; const keys = members.map(order => `settings:${hash}:sorted-list:${list}:${order}`);
values[list] = []; values[list] = [];
for (const order of members) {
keys.push(`settings:${hash}:sorted-list:${list}:${order}`);
}
const objects = await db.getObjects(keys); const objects = await db.getObjects(keys);
objects.forEach((obj) => { objects.forEach((obj) => {

Loading…
Cancel
Save