Skip to content

Commit

Permalink
use Promise.allSettled
Browse files Browse the repository at this point in the history
  • Loading branch information
mfix22 committed Aug 24, 2020
1 parent 9a507f0 commit dde1773
Show file tree
Hide file tree
Showing 7 changed files with 8 additions and 8 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@
"prettier": "^2.0.5"
},
"engines": {
"node": ">= 8.3.0"
"node": "12.x"
},
"jest": {
"collectCoverageFrom": [
Expand Down
2 changes: 1 addition & 1 deletion scripts/write-installations-to-segment.js
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ fetch('https://api.github.com/app/installations?per_page=100', {
})
.then((res) => res.json())
.then(async (installations) => {
return Promise.all(
return Promise.allSettled(
installations.map(async (i) => {
const user = await fetchData(i.account.login)
const email = user.email
Expand Down
2 changes: 1 addition & 1 deletion src/comment/created.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ module.exports = () => async (context) => {

if (!Array.isArray(config.comments)) return

await Promise.all(
await Promise.allSettled(
config.comments.map(async ({ action, pattern, labels } = {}) => {
if (pattern === '$PROFANITY') {
if (!filter.isProfane(body)) {
Expand Down
4 changes: 2 additions & 2 deletions src/installation/added.js
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ module.exports = (robot) => async (context) => {
user: context.payload.installation.account.login,
},
}))
return Promise.all(
return Promise.allSettled(
LABELS_TO_CREATE.map((l) => {
const data = {
owner: context.payload.installation.account.login,
Expand Down Expand Up @@ -72,7 +72,7 @@ module.exports = (robot) => async (context) => {
)
})

await Promise.all(promises)
await Promise.allSettled(promises)

const private_repos = repos.filter((r) => r.private)
analytics.track({
Expand Down
2 changes: 1 addition & 1 deletion src/pull/merged.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ module.exports.deleteBranch = () => async (context) => {

if (!Array.isArray(config.merges)) return

await Promise.all(
await Promise.allSettled(
config.merges.map(async (c) => {
const action = c.action || c

Expand Down
2 changes: 1 addition & 1 deletion src/pull/synchronized.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ module.exports = () => async (context) => {

if (!Array.isArray(config.commits)) return

await Promise.all(
await Promise.allSettled(
config.commits.map(async ({ action, pattern, user, labels } = {}) => {
return executeAction(action, {
[LABEL]: () => {
Expand Down
2 changes: 1 addition & 1 deletion src/thread/labeled.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ module.exports = (queue) => async (context) => {

const ID = getId(context, { action: COMMENT })

await Promise.all(
await Promise.allSettled(
thread.labels.map((label) => {
const action = labelToAction(config, label)

Expand Down

0 comments on commit dde1773

Please # to comment.