Remove unused redis config and do not control redis connection in intent.controller
This commit is contained in:
parent
fec97eb018
commit
04684bba48
@ -1,4 +0,0 @@
|
||||
module.exports = {
|
||||
REDIS_HOST: process.env.REDIS_HOST,
|
||||
REDIS_PORT: process.env.REDIS_PORT
|
||||
}
|
||||
@ -45,8 +45,6 @@ exports.getIntentCommand = async (req, res) => {
|
||||
|
||||
console.log(`\n[Backend Intents] Processing intent.`);
|
||||
|
||||
await redis.client.connect().catch(console.error)
|
||||
|
||||
const intent = await Intent.findOne({ where: { description: req.body.text } });
|
||||
|
||||
if (intent) {
|
||||
@ -61,8 +59,6 @@ exports.getIntentCommand = async (req, res) => {
|
||||
}
|
||||
);
|
||||
|
||||
await redis.client.quit();
|
||||
|
||||
console.log(`Intent matched and published to stream: ${commandId}`);
|
||||
|
||||
return res.json({
|
||||
@ -82,8 +78,6 @@ exports.getIntentCommand = async (req, res) => {
|
||||
}
|
||||
);
|
||||
|
||||
await redis.client.quit();
|
||||
|
||||
console.log(`No intent match, error published: ${errorId}`);
|
||||
|
||||
return res.status(400).json({
|
||||
@ -95,8 +89,6 @@ exports.getIntentCommand = async (req, res) => {
|
||||
});
|
||||
}
|
||||
} catch (err) {
|
||||
await redis.client.quit();
|
||||
|
||||
console.error("getIntentCommand error:", err);
|
||||
|
||||
return res.status(500).send({message: err.message || "Internal server error."});
|
||||
|
||||
Loading…
Reference in New Issue
Block a user