Created
June 1, 2015 06:37
-
-
Save robksawyer/5c2cdad1adf31fc8902f to your computer and use it in GitHub Desktop.
Promise troubles
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| createZipAndUploadToS3 | |
| .then( | |
| function(fileData){ | |
| return uploader.createFileRecord(req.user.id, fileStream, fileData); | |
| } | |
| ) | |
| .then( | |
| function(fileRecord){ | |
| return amazon.createSQSWorkQueue(req.user.id, req.param('name'), settings.aws_s3_render_bucket); | |
| } | |
| ) | |
| .then( | |
| function(queueRecord, fileRecord){ | |
| sails.log("queueRecord"); | |
| sails.log(queueRecord); | |
| sails.log("fileRecord"); | |
| sails.log(fileRecord); | |
| return this.createJobRecord(req, fileRecord, queueRecord); | |
| } | |
| ) | |
| .then( | |
| function(jobRecord){ | |
| sails.log('Created a job with the name ' + jobRecord.name); | |
| req.flash('success', 'Spot instance job ' + jobRecord.name + ' created successfully!'); | |
| res.redirect('jobs/submit/' + jobRecord.id); | |
| }, | |
| function(err){ | |
| if(err){ | |
| return res.negotiate(err); | |
| } | |
| } | |
| ) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment