Skip to content

Commit

Permalink
feat: Keesing document checker re-implemented with WebAPI
Browse files Browse the repository at this point in the history
  • Loading branch information
pgmemk committed Oct 9, 2018
1 parent 5ed6c3a commit 3e0c665
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 13 deletions.
20 changes: 10 additions & 10 deletions src/in-house-bot/jobs/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -108,16 +108,16 @@ export const checkFailedSeals:Executor = async ({ job, components }) => {
return await components.bot.seals.handleFailures({ gracePeriod })
}

export const documentChecker:Executor = async ({ job, components }) => {
const { logger, documentChecker } = components
if (!documentChecker) {
logger.debug('document checker not set up')
return
}

// // document checker rate-limits to 1/min
return await documentChecker.checkPending({ limit: 1 })
}
// export const documentChecker:Executor = async ({ job, components }) => {
// const { logger, documentChecker } = components
// if (!documentChecker) {
// logger.debug('document checker not set up')
// return
// }

// // // document checker rate-limits to 1/min
// return await documentChecker.checkPending({ limit: 1 })
// }

// export const cleanupTmpSNSTopics:Executor = async ({ job, components }) => {
// const { bot, logger } = components
Expand Down
10 changes: 7 additions & 3 deletions src/in-house-bot/lambda/http/documentChecker-webhook.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,11 +21,15 @@ lambda.use(async (ctx) => {
throw new Errors.HttpError(404, 'not found')
}

const { event } = ctx
const { body } = ctx.event
let evt = JSON.parse(body.toString())

try {
await documentChecker.handleVerificationEvent(event)
await documentChecker.handleVerificationEvent(evt)
} catch (err) {
lambda.logger.error('failed to handle documentChecker webhook call', err)
debugger
// lambda.logger.error('failed to handle documentChecker webhook call', err)
ctx.body = `failed to handle documentChecker webhook call: ${err.name}`
ctx.status = 500
ctx.error = new Error('failed')
}
Expand Down

0 comments on commit 3e0c665

Please sign in to comment.