Skip to content

Commit

Permalink
Adding a timeout
Browse files Browse the repository at this point in the history
  • Loading branch information
mrmadhat committed May 1, 2020
1 parent a2b2268 commit 2f173c3
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion get.js
Expand Up @@ -9,7 +9,7 @@ export const main = handler(async (event, context) => {
// - 'noteId': path parameter
Key: {
userId: event.requestContext.identity.cognitoIdentityId,
// noteId: event.pathParameters.id,
noteId: event.pathParameters.id,
},
}

Expand All @@ -19,5 +19,8 @@ export const main = handler(async (event, context) => {
throw new Error("Item not found.")
}

// Set a timeout
await new Promise((resolve) => setTimeout(resolve, 10000))

return result.Item
})

0 comments on commit 2f173c3

Please sign in to comment.