Alexays / Waybar

Highly customizable Wayland bar for Sway and Wlroots based compositors. :v: :tada:
MIT License
6.42k stars 696 forks source link

Waybar not recieving the full JSON object #3425

Open runningnak3d opened 2 months ago

runningnak3d commented 2 months ago

For custom scripts that output JSON objects at a very high rate Waybar doesn't receive the full object and you end up with:

[2024-07-08 18:39:19.681] [error] custom/cava-p: Error parsing JSON: * Line 1, Column 1 Syntax error: value, object or array expected.

[2024-07-08 18:39:22.555] [error] custom/vu-r: Error parsing JSON: * Line 1, Column 1 Syntax error: value, object or array expected.

[2024-07-08 18:39:22.680] [error] custom/vu-l: Error parsing JSON: * Line 1, Column 1 Syntax error: value, object or array expected.

Spammed, non-stop and it chews up a LOT of CPU and due to the bar not receiving the objects, the modules can get wonky...

So after digging into the source for the custom module I decided to add a buffer and some verification so that invalid JSON isn't parsed. It works flawlessly for me, but I am not opening a pull request for a couple of reasons. 1 - I haven't read your code style guidelines. 2 - I haven't had a chance to look over all of the Waybar code, and maybe there is a better place to solve this. 3 - I have only tested it with my modules.

So, I figured I would open an issue and link to my patch. I will be happy to link to my VU meter module and colorized Cava module if you like. The VU meters really demonstrate this issue since they update extremely fast and each segment is a different color (24 segment meters) so a lot of CSS is contained in each JSON object.

https://gist.github.com/runningnak3d/8a392b23130245c4441c247046f2ec3f

Waybar rev: ccc3c132124623bde5127937fe4fc9aa45a9d35d

LukashonakV commented 6 days ago

Hi @Alexays , can you remove cava, clock labels. The issue belongs to custom module