init writes in parallel in case one of them fails
This commit is contained in:
parent
755bafba8a
commit
7974a89bd3
1 changed files with 50 additions and 40 deletions
|
|
@ -1543,7 +1543,10 @@ const unfollow = publicKey =>
|
||||||
const initWall = async () => {
|
const initWall = async () => {
|
||||||
const user = require('../Mediator').getUser()
|
const user = require('../Mediator').getUser()
|
||||||
|
|
||||||
await new Promise((res, rej) => {
|
const promises = []
|
||||||
|
|
||||||
|
promises.push(
|
||||||
|
new Promise((res, rej) => {
|
||||||
user
|
user
|
||||||
.get(Key.WALL)
|
.get(Key.WALL)
|
||||||
.get(Key.NUM_OF_PAGES)
|
.get(Key.NUM_OF_PAGES)
|
||||||
|
|
@ -1555,8 +1558,10 @@ const initWall = async () => {
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
)
|
||||||
|
|
||||||
await new Promise((res, rej) => {
|
promises.push(
|
||||||
|
new Promise((res, rej) => {
|
||||||
user
|
user
|
||||||
.get(Key.WALL)
|
.get(Key.WALL)
|
||||||
.get(Key.PAGES)
|
.get(Key.PAGES)
|
||||||
|
|
@ -1575,8 +1580,10 @@ const initWall = async () => {
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
})
|
})
|
||||||
|
)
|
||||||
|
|
||||||
await new Promise((res, rej) => {
|
promises.push(
|
||||||
|
new Promise((res, rej) => {
|
||||||
user
|
user
|
||||||
.get(Key.WALL)
|
.get(Key.WALL)
|
||||||
.get(Key.PAGES)
|
.get(Key.PAGES)
|
||||||
|
|
@ -1590,6 +1597,9 @@ const initWall = async () => {
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
)
|
||||||
|
|
||||||
|
await Promise.all(promises)
|
||||||
}
|
}
|
||||||
|
|
||||||
module.exports = {
|
module.exports = {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue