Skip to content

perf(web-ui): drive the comments tab off SSE instead of polling - #731

Merged
ngosang merged 1 commit into
amule-org:masterfrom
ngosang:feature/web37
Jul 31, 2026
Merged

perf(web-ui): drive the comments tab off SSE instead of polling#731
ngosang merged 1 commit into
amule-org:masterfrom
ngosang:feature/web37

Conversation

@ngosang

@ngosang ngosang commented Jul 31, 2026

Copy link
Copy Markdown
Member

The download detail's Comments tab re-fetched GET /downloads/{hash}/comments on every tick of the downloads store, so an open tab on an active download issued roughly one request per second. amuled already emits a comments_updated SSE event whose payload is byte-for-byte that same body (EVENTS.md), and it was simply not wired up on the client.

  • events.js: subscribe to comments_updated and republish it on the "comments:updated" store key, matching the existing search:result / log:appended one-off event pattern.
  • download-detail.js: DownloadComments now fetches once per hash and applies the event payload directly when its hash matches, so retrieved Kad notes and source-reported comments both land without polling. Because EqualComments is deliberately excluded from EqualDownload, notes arriving mid-search on an otherwise idle (paused/stopped) download previously stayed invisible until the lookup finished; they now show up as they arrive.
  • The "Searching Kad…" button state reads kad_comment_search_running from the downloads store rather than from the comments body: the Comments tab pins liveTick to 0, so the detail object never refreshes while that tab is open, whereas the list item does (the flag is part of EqualDownload, so its start -> finish edge arrives as download_updated).

Verified against a running amuled: one GET /comments over a 90s open tab (previously one per tick), the button flipping to "Searching Kad…" and back on a real Kad lookup, and no console errors.

The download detail's Comments tab re-fetched GET /downloads/{hash}/comments
on every tick of the downloads store, so an open tab on an active download
issued roughly one request per second. amuled already emits a comments_updated
SSE event whose payload is byte-for-byte that same body (EVENTS.md), and it was
simply not wired up on the client.

- events.js: subscribe to comments_updated and republish it on the
  "comments:updated" store key, matching the existing search:result /
  log:appended one-off event pattern.
- download-detail.js: DownloadComments now fetches once per hash and applies
  the event payload directly when its hash matches, so retrieved Kad notes and
  source-reported comments both land without polling. Because EqualComments is
  deliberately excluded from EqualDownload, notes arriving mid-search on an
  otherwise idle (paused/stopped) download previously stayed invisible until
  the lookup finished; they now show up as they arrive.
- The "Searching Kad…" button state reads kad_comment_search_running from the
  downloads store rather than from the comments body: the Comments tab pins
  liveTick to 0, so the detail object never refreshes while that tab is open,
  whereas the list item does (the flag is part of EqualDownload, so its
  start -> finish edge arrives as download_updated).

Verified against a running amuled: one GET /comments over a 90s open tab
(previously one per tick), the button flipping to "Searching Kad…" and back on
a real Kad lookup, and no console errors.
@ngosang
ngosang merged commit 4275949 into amule-org:master Jul 31, 2026
15 checks passed
@ngosang
ngosang deleted the feature/web37 branch July 31, 2026 00:25
LSalami added a commit to LSalami/amule that referenced this pull request Jul 31, 2026
muleToolbar() duplicated several msgid source-location references
(Networks, Searches, Downloads Window, etc.) already present via
amuleDlg.cpp's own toolbar setup. Deleting it drops those now-stale
#: comments; no msgid added, removed, or retranslated -- verified via
unchanged msgid count (1903 before/after) and a diff limited to
source-location comments and POT-Creation-Date.

Regenerated after rebasing onto upstream/master to pick up po/
changes from amule-org#723/amule-org#724/amule-org#726/amule-org#728/amule-org#730/amule-org#731, which had drifted our
prior regeneration out of sync.
got3nks pushed a commit that referenced this pull request Jul 31, 2026
…r.cpp (#675) (#725)

* chore(gui): delete unreachable bitmap functions/entries from muuli_wdr.cpp

First slice of the icon-system cleanup scoped in #675: remove code with
zero call sites anywhere in the tree, before any wxArtProvider migration
work starts.

- muleToolbar(): whole function unused -- superseded by the main
  wxToolBar setup in amuleDlg.cpp; nothing calls it.
- moreImages(): whole function unused, both of its two icon entries.
- amuleDlgImages(): 21 of 35 index blocks have no caller anywhere
  (0-13, 16, 17, 19, 27, 28, 31, 34). The 14 live ones are untouched --
  10 of those (20-26, 29, 32, 33) are already the fallback path inside
  amuleDlg.cpp's Add_Skin_Icon, which prefers a wxArtProvider/SVG lookup
  first; the other 4 (14, 15, 18, 30) are still called directly.
- amuleSpecial(): 6 of 26 index blocks have no caller (6, 7, 8, 9, 18,
  20) -- checked both direct call sites and the PrefsUnifiedDlg.cpp
  fallback table (pages[].m_imageidx), which uses neither.

convert_xpm in PartFileConvertDlg.cpp was on the same "no literal
grep hits" list initially but is not actually dead -- SetIcon(wxICON
(convert)) reaches it via the wxICON macro's token-pasting
(X##_xpm), invisible to a plain identifier search. Caught by a full
build failing on the undeclared identifier, not by inspection; left
untouched.

Deletes 1373 lines (~16% of the file). No behavior change: every
touched entry was unreachable code. clang-format v18 clean; full
amule build verified (macOS, CLIENT_GUI unaffected since neither
touched symbol is CLIENT_GUI-only).

* chore(po): regenerate catalogs after muuli_wdr.cpp dead-code removal

muleToolbar() duplicated several msgid source-location references
(Networks, Searches, Downloads Window, etc.) already present via
amuleDlg.cpp's own toolbar setup. Deleting it drops those now-stale
#: comments; no msgid added, removed, or retranslated -- verified via
unchanged msgid count (1903 before/after) and a diff limited to
source-location comments and POT-Creation-Date.

Regenerated after rebasing onto upstream/master to pick up po/
changes from #723/#724/#726/#728/#730/#731, which had drifted our
prior regeneration out of sync.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant