mirror of
https://github.com/IT4Change/Ocelot-Social.git
synced 2025-12-13 07:45:56 +00:00
We had this error in our neo4j pod recently: ``` 2019-12-02 08:29:42.680+0000 ERROR Unable to schedule bolt session 'bolt-1018230' for execution since there are no available threads to serve it at the moment. You can retry at a later time or consider increasing max thread pool size for bolt connector(s). 2019-12-02 08:29:42.680+0000 ERROR Unable to schedule bolt session 'bolt-1018224' for execution since there are no available threads to serve it at the moment. You can retry at a later time or consider increasing max thread pool size for bolt connector(s). 2019-12-02 08:29:42.681+0000 ERROR Unable to schedule bolt session 'bolt-1018352' for execution since there are no available threads to serve it at the moment. You can retry at a later time or consider increasing max thread pool size for bolt connector(s). 2019-12-02 08:29:42.682+0000 ERROR Unable to schedule bolt session 'bolt-1018243' for execution since there are no available threads to serve it at the moment. You can retry at a later time or consider increasing max thread pool size for bolt connector(s). ``` Apparently the default is 400 threads. So we must have a leak somewhere.
33 lines
1.0 KiB
JavaScript
33 lines
1.0 KiB
JavaScript
import uniqueSlug from './slugify/uniqueSlug'
|
|
|
|
const isUniqueFor = (context, type) => {
|
|
return async slug => {
|
|
const session = context.driver.session()
|
|
try {
|
|
const response = await session.run(`MATCH(p:${type} {slug: $slug }) return p.slug`, {
|
|
slug,
|
|
})
|
|
return response.records.length === 0
|
|
} finally {
|
|
session.close()
|
|
}
|
|
}
|
|
}
|
|
|
|
export default {
|
|
Mutation: {
|
|
SignupVerification: async (resolve, root, args, context, info) => {
|
|
args.slug = args.slug || (await uniqueSlug(args.name, isUniqueFor(context, 'User')))
|
|
return resolve(root, args, context, info)
|
|
},
|
|
CreatePost: async (resolve, root, args, context, info) => {
|
|
args.slug = args.slug || (await uniqueSlug(args.title, isUniqueFor(context, 'Post')))
|
|
return resolve(root, args, context, info)
|
|
},
|
|
UpdatePost: async (resolve, root, args, context, info) => {
|
|
args.slug = args.slug || (await uniqueSlug(args.title, isUniqueFor(context, 'Post')))
|
|
return resolve(root, args, context, info)
|
|
},
|
|
},
|
|
}
|