Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
X
xpub-faraday
Manage
Activity
Members
Labels
Plan
Issues
2
Issue boards
Milestones
Iterations
Wiki
Requirements
Code
Merge requests
0
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Deploy
Releases
Container Registry
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
This is an archived project. Repository and other project resources are read-only.
Something went wrong on our end
Show more breadcrumbs
xpub
xpub-faraday
Merge requests
!236
Jobs crash
Code
Review changes
Check out branch
Download
Patches
Plain diff
Merged
Jobs crash
jobs-crash
into
develop
Overview
0
Commits
3
Pipelines
0
Changes
8
Merged
Andrei Cioromila
requested to merge
jobs-crash
into
develop
6 years ago
Overview
0
Commits
3
Pipelines
0
Changes
3
Expand
0
0
Merge request reports
Viewing commit
aa20a9d0
Prev
Next
Show latest version
3 files
+
12
−
9
Inline
Compare changes
Side-by-side
Inline
Show whitespace changes
Show one file at a time
Files
3
Search (e.g. *.vue) (Ctrl+P)
aa20a9d0
fix(jobs): Cancel jobs sequentially so we don't exhaust the db connection pool
· aa20a9d0
Andrei Cioromila
authored
6 years ago
packages/component-invite/src/routes/collectionsInvitations/delete.js
+
8
−
6
Options
const
{
last
,
get
,
chain
,
difference
}
=
require
(
'
lodash
'
)
const
Promise
=
require
(
'
bluebird
'
)
const
config
=
require
(
'
config
'
)
const
{
@@ -12,8 +14,6 @@ const {
const
Job
=
require
(
'
pubsweet-component-jobs
'
)
const
{
last
,
get
,
chain
,
difference
}
=
require
(
'
lodash
'
)
const
s3Config
=
get
(
config
,
'
pubsweet-component-aws-s3
'
,
{})
const
notifications
=
require
(
'
./emails/notifications
'
)
@@ -134,10 +134,12 @@ module.exports = models => async (req, res) => {
})),
]
fragment
.
invitations
.
forEach
(
inv
=>
{
Job
.
cancelQueue
(
`removal-
${
inv
.
userId
}
-
${
inv
.
id
}
`
)
Job
.
cancelQueue
(
`reminders-
${
inv
.
userId
}
-
${
inv
.
id
}
`
)
})
await
Promise
.
each
(
fragment
.
invitations
,
async
inv
=>
Promise
.
all
([
Job
.
cancelQueue
(
`removal-
${
inv
.
userId
}
-
${
inv
.
id
}
`
),
Job
.
cancelQueue
(
`reminders-
${
inv
.
userId
}
-
${
inv
.
id
}
`
),
]),
)
fragment
.
invitations
=
[]
fragment
.
recommendations
=
[]