Skip to content

Commit

Permalink
async
Browse files Browse the repository at this point in the history
  • Loading branch information
jvisker committed Nov 1, 2023
1 parent 07f73c7 commit d23f90b
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions src/app.js
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ app.get('/', async (req, res) => {
res.status(500).send('Error reading table or S3')
}
})
function mySlowFunction (baseNumber) {
async function mySlowFunction (baseNumber) {
console.time('mySlowFunction')
let result = 0
for (let i = Math.pow(baseNumber, 7); i >= 0; i--) {
Expand All @@ -46,7 +46,9 @@ function mySlowFunction (baseNumber) {
}
app.get('/cpu/:complexity', async (req, res) => {
try {
mySlowFunction(Number(req.params.complexity))
mySlowFunction(Number(req.params.complexity)).then(() => {}).catch((err) => {
console.log(err)
})
res.send({
ping: 'pong'
})
Expand Down

0 comments on commit d23f90b

Please sign in to comment.