api: derive multicast subscriber/publisher counts from live users#653
Open
armcconnell wants to merge 1 commit into
Open
api: derive multicast subscriber/publisher counts from live users#653armcconnell wants to merge 1 commit into
armcconnell wants to merge 1 commit into
Conversation
The device, metro, facility, and contributor handlers read the on-chain multicast_subscribers_count / multicast_publishers_count fields from dz_devices_current. In production these are frequently stale or 0 even when the device has active multicast subscribers, so DZDs showed 0 subscribers and 0 available capacity (appearing oversubscribed) despite real users (#650). Derive the per-device subscriber and publisher counts from dz_users_current instead, counting activated multicast users with a non-empty subscribers / publishers array (a user that both publishes and subscribes counts in each). The metro and contributor aggregates and the facility rollup now sum these live counts, and the effective-max capacity is floored at the live count.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Resolves: #650
Summary of Changes
dz_users_currentdata instead of the stale on-chainmulticast_subscribers_count/multicast_publishers_countfields ondz_devices_current. In production those on-chain fields are frequently 0 even when a device has active subscribers, so DZDs showed 0 subscribers and 0 available capacity (appearing oversubscribed) despite real users.subscribersarray is non-empty and as a publisher when itspublishersarray is non-empty; a user that does both counts in each.Diff Breakdown
Small, focused query changes in four handlers; the bulk of the diff is new handler tests.
Key files (click to expand)
api/handlers/metros.go— replace on-chain sub/pub counts with adevice_multicast_liveCTE in both the list (shared const) and detail queriesapi/handlers/facilities.go— sum live per-device counts in the facility rollup CTEapi/handlers/contributors.go— sum live per-device counts in the contributor detail queryapi/handlers/devices.go— extend the multicast CTE to compute live sub/pub counts for the device list and detailTesting Verification
api/handlerspackage test suite passes.