5 Commits
Author SHA1 Message Date
dipetm 6730436408 Keep the deferral inside processlist instead of the base class
The base class carried a lazy_views flag, a _views_source field, a _build_views split
and an introspection check for subclasses that decorate their views - all of it shared
by 37 plugins to serve one. Overriding update_views/get_views in processlist does the
same with no change to model.py, and set_views/reset_views clear the pending flag so a
reset stays reset.
2026-08-07 16:06:39 +03:00
dipetm 7cfbebb6e5 Read the stats once, drop the early return, stop poisoning the shared singleton
update_views() called get_raw() twice and returned an empty dict from a separate exit;
one read and one exit instead, with the deferred case named in the docstring.

The test fixture built its own ProcesslistPlugin, whose load() writes Mock attributes
into the glances_processes singleton and broke seven tests in test_core.py whenever the
two files ran together. It now takes the shared plugin and restores what it changes.
2026-08-07 15:52:49 +03:00
dipetm e6f3145ef5 Trim the comments and drop a test that guarded nothing
One rationale in one place instead of three, and the class attribute no longer
describes the per-key build that is gone. test_unknown_key_raises only exercised
dict lookup and passed unchanged on develop.
2026-08-07 15:29:24 +03:00
dipetm 397ec8dec6 Defer the whole view build instead of doing it per key
A dict subclass that built entries on access turned out to be more machinery than the
problem needs: nothing outside the plugin reads .views directly, and every per-item
caller belongs to a plugin that builds eagerly. Remembering the stats and building once,
on the first read, gives the same result with a plain dict.
2026-08-07 15:24:24 +03:00
dipetm 844895f3cb perf: build process views on demand instead of up front 2026-08-07 14:35:35 +03:00