Javascript Node.js:获取响应中断代码
请查看此服务器日志:Javascript Node.js:获取响应中断代码,javascript,node.js,Javascript,Node.js,请查看此服务器日志: 2011-11-07T23:12:23+00:00 heroku[web.1]: State changed from starting to up 2011-11-07T23:12:41+00:00 app[web.1]: DONEE 2011-11-07T23:12:41+00:00 app[web.1]: { text: 'oh my jesus has his hands and a happy', 2011-11-07T23:13:20+00:00 heroku[
2011-11-07T23:12:23+00:00 heroku[web.1]: State changed from starting to up
2011-11-07T23:12:41+00:00 app[web.1]: DONEE
2011-11-07T23:12:41+00:00 app[web.1]: { text: 'oh my jesus has his hands and a happy',
2011-11-07T23:13:20+00:00 heroku[router]: Error H12 (Request timeout) -> GET tda-tr.herokuapp.com/ dyno=web.1 queue= wait= service=30000ms status=503 bytes=0
2011-11-07T23:13:20+00:00 app[web.1]: 10.64.147.7 - - [Mon, 07 Nov 2011 23:13:20 GMT] "GET /?url=http://api.twilio.com/2010-04-01/Accounts/aa/Recordings/REaf654cfe0ec6969434ff9a318f2156cc HTTP/1.1" 500 37 "-" "-"
2011-11-07T23:13:39+00:00 app[web.1]: DONEE
2011-11-07T23:13:39+00:00 app[web.1]: { text: 'oh my jesus has his hands and a happy',
2011-11-07T23:13:39+00:00 app[web.1]: confidence: '0.0920561030507088',
2011-11-07T23:13:39+00:00 app[web.1]: result: 'success' }
2011-11-07T23:13:39+00:00 app[web.1]: 10.4.250.139 - - [Mon, 07 Nov 2011 23:13:39 GMT] "GET /?url=http://api.twilio.com/2010-04-01/Accounts/aa/Recordings/REaf654cfe0ec6969434ff9a318f2156cc HTTP/1.1" 500 101 "-" "-"
执行相同请求2次,第一次出现错误:
2011-11-07T23:12:41+00:00 app[web.1]: { text: 'oh my jesus has his hands and a happy',
2011-11-07T23:13:20+00:00 heroku[router]: Error H12 (Request timeout) -> GET tda-tr.herokuapp.com/ dyno=web.1 queue= wait= service=30000ms status=503 bytes=0
但是第二次,没有任何变化,它起作用了
这是请求的代码:
request.post
headers:
"content-type": format
url: ispeech_server
#Setting audio buffer data as body
body: audio
, (error, response, body) ->
#If its not an error then do the follow below otherwise just sleep and relax
if not error and response.statusCode is 200
#Parsing Query String in body reponse into JSON
parse = querystring.parse(body)
console.log "DONEE"
console.log parse
res.send parse,"Content-Type": "application/json", 500
else
res.send "Error - iSpeech API returned an error",
"Content-Type": "text/plain"
, 500
else
res.send "Invalid URL - File Not Found",
"Content-Type": "text/plain"
, 404
else
#If not url is supplied then send this
res.send "Invalid URL - File Not Set",
"Content-Type": "text/plain"
, 404
JavaScript代码:
什么可能导致这种情况?谢谢
编辑:iSpeech API在Heroku允许的30秒后返回一个错误,并使所有代码崩溃。如果是这样的话,等待时间不超过30秒的最佳方式是什么?@RyanOlds为什么会出现coffeescript问题?如果包含JavaScript,您将获得更多帮助。调试生成的JS比通过CS的抽象进行调试更容易。回答你的问题,很容易搞乱CS代码,直到你看到它编译成什么样子才意识到。@Ryanold这里是代码的要点:感谢上帝CS不可读,亲爱的上帝,编译的JS不可读