Skip to content

Synchronous reads #82

Description

@eliasmalik

Here: https://github.com/fac-u/autocompleter/blob/master/src/autocomplete.js#L7

Synchronous reads are blocking and will stop your server from responding to subsequent requests while it completes. Not a big deal here, but in a real project it can be a problem. It's best to avoid synchronous operations if possible.

You are also reading the orderedDict.json every time you call the autocomplete function. This is quite inefficient.

A better solution which would avoid having to change the API of your autocomplete function to be asynchronous would be to read the orderedDict.json into memory when the server starts. Then your function would simply reference an in-memory object (relatively fast) instead of reading a file (relatively slow).

Metadata

Metadata

Labels

No labels
No labels

Type

No type

Fields

No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions