caksoylar / keymap-drawer

Visualize keymaps that use advanced features like hold-taps and combos, with automatic parsing
https://caksoylar.github.io/keymap-drawer
MIT License
688 stars 58 forks source link

Glyph download timeouts #116

Open minusfive opened 3 days ago

minusfive commented 3 days ago

Have been experiencing regular timeouts / failures, seem related to the glyphs download step: https://github.com/minusfive/zmk-config/actions/runs/11321454822/job/31500930916

INFO: using config args: -c keymap-drawer/config.yaml
INFO: drawing for corneish_zen
INFO:   got extra parse args: 
INFO:   got extra draw args: 
Traceback (most recent call last):
  File "/home/runner/.local/bin/keymap", line 8, in <module>
    sys.exit(main())
  File "/home/runner/.local/lib/python3.10/site-packages/keymap_drawer/__main__.py", line 212, in main
    draw(args, config.draw_config)
  File "/home/runner/.local/lib/python3.10/site-packages/keymap_drawer/__main__.py", line 43, in draw
    drawer = KeymapDrawer(
  File "/home/runner/.local/lib/python3.10/site-packages/keymap_drawer/draw/draw.py", line 25, in __init__
    self.init_glyphs()
  File "/home/runner/.local/lib/python3.10/site-packages/keymap_drawer/draw/glyph.py", line 58, in init_glyphs
    self.name_to_svg |= self._fetch_glyphs(rest)
  File "/home/runner/.local/lib/python3.10/site-packages/keymap_drawer/draw/glyph.py", line 88, in _fetch_glyphs
    return dict(zip(names, p.map(fetch_fn, names, urls, timeout=FETCH_TIMEOUT)))
  File "/usr/lib/python3.10/concurrent/futures/_base.py", line 623, in result_iterator
    yield _result_or_cancel(fs.pop(), end_time - time.monotonic())
  File "/usr/lib/python3.10/concurrent/futures/_base.py", line 319, in _result_or_cancel
    return fut.result(timeout)
  File "/usr/lib/python3.10/concurrent/futures/_base.py", line 460, in result
    raise TimeoutError()
concurrent.futures._base.TimeoutError
ERROR: parsing or drawing failed for corneish_zen!
Error: Process completed with exit code 1.

Started noticing a few days ago, where about 50% of jobs failed. Then it's gradually gone up until the last bunch of runs which have consistently failed: https://github.com/minusfive/zmk-config/actions/runs/11321454822/usage

Update

Locally it works fine every time, it seems. So potentially a GH specific networking issue? Or perhaps the icon lib hosts are blocking GH requests?

caksoylar commented 2 days ago

Thanks for reporting, I wonder if it is something adding retries would solve. There's no logging that says on which glyph fetch it failed, so it is hard to tell from the logs. If it isn't solved by retries, one solution I can think of is to have our own cache in GH with glyphs. Or prioritize #85, even though it'd require manual work on users.

caksoylar commented 2 days ago

Also, it looks like you use mdi, so I assume you see the errors with that source.

caksoylar commented 2 days ago

I pushed https://github.com/caksoylar/keymap-drawer/commit/bbead1c2a268c9f26e6331491e4d81a91dfdfa40, so hopefully we should be able to see which URL fetch is timing out specifically.

minusfive commented 2 days ago

Of course, now it won't fail 🤣 https://github.com/minusfive/zmk-config/actions/runs/11329959089/job/31519554766