我正在开发 Slack 应用程序,我必须使用外部API查询数据库,然后向用户显示一些结果。事实上,查询此数据库需要一些时间,Slack需要3秒内的响应,否则会出现超时错误。
我已经考虑过使用 Celery 为Slack提供一些答案,而另一个函数会查询数据库,但我很难编写处理这些多个响应的代码。
我试图执行以下操作:
'Querying database'
但是当我运行这个应用程序时,我只得到items: [ {
"venue": {
"id": "4e82750f8b8185a7c93d3632",
"name": "Puregold Meycauyan",
"contact": {},
"location": {
"crossStreet": "Meycauayan",
"lat": 14.72670029378359,
"lng": 120.96040348293954,
"labeledLatLngs": [
{
"label": "display",
"lat": 14.72670029378359,
"lng": 120.96040348293954
}
],
"cc": "PH",
"city": "Bulacan",
"state": "Bulacan",
"country": "Pilipinas",
"formattedAddress": [
"Meycauayan",
"Bulacan",
"Bulacan",
"Pilipinas"
]
},
"tips": [
{
"id": "4f656942e4b08b4770548244",
"createdAt": 1332046146,
"text": "This grocery opens early and the lines are never long.",
"type": "user",
"canonicalUrl": "https://foursquare.com/item/4f656942e4b08b4770548244",
}
];
}];
。我做错了什么?