Skip to content

Cache codecogs equation rendering to avoid timeout errors #15

@apjanke

Description

@apjanke

About half the time I run make docs, it errors out due to a timeout on a codecogs web service query.

>> mlxshake_make docs
Exporting: MlxShake doc file: Tutorial.mlx
Exporting: /Users/janke/local/repos/MlxShake/docs-src/Tutorial.mlx -> /private/var/folders/_4/9mx5ryp52bb_z6drbcbrhwl40000gn/T/tpd7f7c402_3583_42c8_a38d_92d44747d285/Tutorial.tex
Exported:  /Users/janke/local/repos/MlxShake/docs-src/Tutorial.mlx -> /private/var/folders/_4/9mx5ryp52bb_z6drbcbrhwl40000gn/T/tpd7f7c402_3583_42c8_a38d_92d44747d285/Tutorial.tex
Exporting: /private/var/folders/_4/9mx5ryp52bb_z6drbcbrhwl40000gn/T/tpd7f7c402_3583_42c8_a38d_92d44747d285/Tutorial.tex -> /Users/janke/local/repos/MlxShake/docs/Tutorial.md
Error using websave (line 98)
The connection to URL
'https://latex.codecogs.com/gif.latex?%5Cbegin%7Barray%7D%7Bl%7D&space%3B%5Csin&space%3Bx=-%5Cint&space%3B%5Ccos&space%3Bxdx%5C%5C&space%3B%5Ccos&space%3Bx=%5Cint&space%3B%5Csin&space%3Bxdx&space%3B%5Cend%7Barray%7D' timed out
after 5.000 seconds. The reason is "Resolving timed out after 5103 milliseconds". Perhaps the server is not responding or weboptions.Timeout needs to be set to a higher value.
Error in janklab.mlxshake.internal.LsLatex2MardkownExporter>grabCodecogsEquationImage (line 538)
websave(file, codecogsUrl);
Error in janklab.mlxshake.internal.LsLatex2MardkownExporter>saveCodecogsRender (line 522)
grabCodecogsEquationImage(equationCode, file);
Error in janklab.mlxshake.internal.LsLatex2MardkownExporter>processEquations (line 489)
                [mdImgTag, eqnum] = saveCodecogsRender(eqncode, outImagesRelDir, outImagesDir, eqnum);
Error in janklab.mlxshake.internal.LsLatex2MardkownExporter/lslatex2markdown (line 154)
            str2md = processEquations(str2md, opts, inImagesRelDir, inImagesDir);
Error in janklab.mlxshake.lslatex2markdown (line 34)
outMdFile = exporter.lslatex2markdown(inFile, opts);
Error in janklab.mlxshake.exportlivescript (line 157)
            mdFile = janklab.mlxshake.lslatex2markdown(texFile, opts2);
Error in mlxshake_gendocs (line 42)
        janklab.mlxshake.exportlivescript(mlxFile, {'outFile', mdFile});
Error in mlxshake_make>build_docs (line 110)
mlxshake_gendocs(parts);
Error in mlxshake_make (line 40)
  build_docs(varargin) 
>> 

Mabye cache the codecogs results (safely) so this doesn't happen so often.

Metadata

Metadata

Assignees

Labels

enhancementNew feature or request

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions