My Custom action code is connecting to the database & fetching results. As this process takes more than 3 seconds, I get an 'http_time out" error while integrating with slack. In order to avoid this, I am trying an async method like below: Even this also not resolving an issue. Please advise am I missing anything here.
class ActionXDays(Action):
def name(self) -> Text:
return "action_x_days"
async def run(self, dispatcher: CollectingDispatcher,
tracker: Tracker,
domain: Dict[Text, Any]) -> List[Dict[Text, Any]]:
intent = tracker.latest_message['intent'].get('name')
metric = ""
res = ""
for e in tracker.latest_message['entities']:
if e['entity'] == 'metric':
metric = e['value']
dispatcher.utter_message("Identified Intent and currently fetching your information...")
if metric == ‘cny’:
dispatcher.utter_message("Connecting to data warehouse...")
data = pd.read_sql_query(sql_cons, conn)
res = f"{metric} values is {data[‘re’s][0]}”
conn.close()
dispatcher.utter_message(text=res)
return []