-
Notifications
You must be signed in to change notification settings - Fork 22
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Lionelb/nlp timeout #2556
Lionelb/nlp timeout #2556
Conversation
Muchas gracias ! |
Ce serait pas mal de laisser en comment le chemin vers l'API master dans le .env, ça permet de démarrer le projet uniquement avec le front |
je vais mettre les 2 commandes |
fetch(url, options), | ||
fetch(url, options).then(async (response) => { | ||
const data = await response.json(); | ||
if (response.ok) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
handle 40x and 500x responses as error
@@ -8,7 +8,7 @@ const logger = createLogger({ | |||
level: "info", | |||
transports: [ | |||
new Console({ | |||
format: format.simple(), | |||
format: format.prettyPrint(), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
use json in log (see 12 factor app)
sources: [SOURCES.THEMES], | ||
}), | ||
]; | ||
if (query_vector) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this avoid to send erroneous query to ES
@@ -93,7 +95,8 @@ router.get("/items", async ctx => { | |||
} | |||
|
|||
const [item] = response.body.hits.hits; | |||
ctx.body = { ...item }; | |||
delete item.title_vector; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
we remove title_vector
from response in items route
sources, | ||
`${NLP_URL}/api/search?q=${encodeURIComponent(title.toLowerCase())}` | ||
).catch((error) => { | ||
logger.error(error.message); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this allow to log error message (when timeout)
API
DOC