4 ms·
> webserver which calls a parser module which calls an external library There's your problem right there. Nested calls are killing us. That parser module shou
by ItsMonkk 5y ago
> webserver which calls a parser module which calls an external library
There's your problem right there. Nested calls are killing us.
That parser module should be a pure transformation function. If it has requirements, your main webserver should be fetching it. If you need to first query the parser to know if it has any requirements for this call, you can do so as a separate pure function. That query will then respond with a value that your webserver can then use to call the external library with. When the impure external library responds, with no external changes, you can now pass that into the parser module to get your parsed object out.
Now when you want to add logging to the external library, ideally you can do so at the webserver level, but otherwise you only need to add logging to the external library, and your parser doesn't change at all.