I'm trying to make XMLRPC requests for each server and then combine all data into total variable. Thing is that I get "pending" as a return and with setTimeout is "fullfiled" I mean I know that first one is still processing and another one is that it succeded but how to get actual arrays? What am I doing wrong that it doesn't return values?
const servers = ["server1", "server2];
try {
const total = servers.map(async server => {
const res = await sendXMLRPCRequest(null, server, Commands.get_all_devices_id)
res.map(unit => {
return {
"id": unit,
"server": server,
"modules": []
}
})
})
setTimeout(() => console.log(total), 5000)
console.log(total)
}
catch (err) {
console.log(err)
}