promise race in backend

This commit is contained in:
Sendou 2019-12-15 17:01:19 +02:00
parent 3eb635bb2e
commit c0cd59c373
3 changed files with 10 additions and 7 deletions

View File

@ -78,6 +78,7 @@ const BuildCard = ({
{build.description && showDescription && (
<Popup
content={buildDescription}
style={{ whiteSpace: "pre-wrap" }}
trigger={
<Icon
style={{ marginLeft: "0.25em" }}

View File

@ -144,12 +144,14 @@ const resolvers = {
const faPost = new FAPost({ ...args, discord_id: ctx.user.discord_id })
args.user = ctx.user
await Promise.all([faPost.save(), sendFAPostToDiscord(args)]).catch(e => {
throw (new UserInputError(),
{
invalidArgs: args,
})
})
await Promise.race([faPost.save(), sendFAPostToDiscord(args)]).catch(
e => {
throw (new UserInputError(),
{
invalidArgs: args,
})
}
)
return true
},

View File

@ -51,7 +51,7 @@ function sendFAPostToDiscord(args) {
)
}
return () => Hook.send(msg)
return Hook.send(msg)
}
module.exports = sendFAPostToDiscord