فهرست منبع

added null check to health check controller

Henry Oswald 10 سال پیش
والد
کامیت
872612a8d3

+ 2 - 2
services/spelling/app/coffee/HealthCheckController.coffee

@@ -12,8 +12,8 @@ module.exports =
 				language: "en"
 			timeout: 1000 * 20
 		request.post opts, (err, response, body)->
-			console.log body?.misspellings[0]?.suggestions.length
-			numberOfSuggestions = body?.misspellings[0]?.suggestions?.length
+			console.log body?.misspellings?[0]?.suggestions.length
+			numberOfSuggestions = body?.misspellings?[0]?.suggestions?.length
 			if numberOfSuggestions > 10
 				logger.log "health check passed"
 				res.sendStatus 200

+ 2 - 1
services/spelling/app/coffee/SpellingAPIController.coffee

@@ -10,7 +10,8 @@ module.exports = SpellingAPIController =
 			if error?
 				logger.err err:error, user_id:req?.params?.user_id, word_count: req?.body?.words?.length, "error processing spelling request"
 				return res.sendStatus(500)
-			res.send(result)
+			# res.send(result)
+			res.writeHead 200
 
 	learn: (req, res, next) ->
 		metrics.inc "spelling-learn", 0.1