ParallelSaveError: Can't save() the same doc multiple times in parallel.
Created by: abraha2d
Describe the bug
If multiple subscriptions are set for a course, all but the first subscription error out with ParallelSaveError: Can't save() the same doc multiple times in parallel.
To Reproduce Steps to reproduce the behavior:
- Go to the subscriptions page.
- Add 2 subscriptions for the same course.
- Switch to backend console.
- See error.
Expected behavior Multiple subscriptions for a course all succeed.
Screenshots
(node:21786) UnhandledPromiseRejectionWarning: ParallelSaveError: Can't save() the same doc multiple times in parallel. Document: 5b72536ea94963551a772498
at ParallelSaveError.MongooseError [as constructor] (/var/www/html/coursewatch-backend/node_modules/mongoose/lib/error/mongooseError.js:11:11)
at new ParallelSaveError (/var/www/html/coursewatch-backend/node_modules/mongoose/lib/error/parallelSave.js:18:17)
at model.Model.save (/var/www/html/coursewatch-backend/node_modules/mongoose/lib/model.js:345:23)
at /var/www/html/coursewatch-backend/src/services/ellucian/index.js:64:10
at tryCatcher (/var/www/html/coursewatch-backend/node_modules/bluebird/js/release/util.js:16:23)
at Promise._settlePromiseFromHandler (/var/www/html/coursewatch-backend/node_modules/bluebird/js/release/promise.js:512:31)
at Promise._settlePromise (/var/www/html/coursewatch-backend/node_modules/bluebird/js/release/promise.js:569:18)
at Promise._settlePromise0 (/var/www/html/coursewatch-backend/node_modules/bluebird/js/release/promise.js:614:10)
at Promise._settlePromises (/var/www/html/coursewatch-backend/node_modules/bluebird/js/release/promise.js:693:18)
at Async._drainQueue (/var/www/html/coursewatch-backend/node_modules/bluebird/js/release/async.js:133:16)
at Async._drainQueues (/var/www/html/coursewatch-backend/node_modules/bluebird/js/release/async.js:143:10)
at Immediate.Async.drainQueues (/var/www/html/coursewatch-backend/node_modules/bluebird/js/release/async.js:17:14)
at runCallback (timers.js:810:20)
at tryOnImmediate (timers.js:768:5)
at processImmediate [as _immediateCallback] (timers.js:745:5)
(node:21786) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). (rejection id: 1)
(node:21786) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.
Additional context N/A