Skip to content
This repository has been archived by the owner on Sep 24, 2024. It is now read-only.

Improve control over calls made to IBM Watson #146

Closed
RafaelAPB opened this issue May 22, 2019 · 2 comments
Closed

Improve control over calls made to IBM Watson #146

RafaelAPB opened this issue May 22, 2019 · 2 comments
Assignees

Comments

@RafaelAPB
Copy link
Contributor

We may want to impose a limit over calls made to IBM Watson.
A quick option, although insecure, is to save the number of requests per session in a map. If a user utilizes more than x calls, block him until next session.

/*if (requestNumber.get(req.user.email) > 100)    {
    UtilsRoutes.replyFailure(res,e,"Too many requests. Please try later");
    ba_logger.important("BA|CHATBOT|WARNING|TOO MANY REQUEST|" + req.user.email);
    throw new Error ("Too many requests");
}*/

A better solution would be to persist the number of calls, imposing a limit. When the limit is crossed, the calls are blocked for that user, and a timestamp is saved. After x time passes, the user can make calls again.

@RafaelAPB
Copy link
Contributor Author

let requestNumber = new Map();

@RafaelAPB RafaelAPB self-assigned this Jun 1, 2019
@RafaelAPB RafaelAPB added Category: Coding Mr Thesis Chatbot related issues labels Jun 1, 2019
@RafaelAPB
Copy link
Contributor Author

related with #189

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

2 participants