feat(api): implement active_votes, payout branches, fix N+1 (PR#5a) - #382
Open
ety001 wants to merge 1 commit into
Open
feat(api): implement active_votes, payout branches, fix N+1 (PR#5a)#382ety001 wants to merge 1 commit into
ety001 wants to merge 1 commit into
Conversation
…+1 (PR#5a) First step of the get_discussion gray-release milestone. Makes buildPostObject produce condenser-compatible output by implementing the three TODO stubs that produced empty/wrong data. - active_votes: parse the hive_posts_cache.votes CSV (format: voter,rshares,percent,reputation per line) into steemd-style vote objects, with reputation converted via repToRaw (mirrors legacy _hydrate_active_votes + rep_to_raw). - payout: implement the is_paidout branch — total_payout_value vs pending_payout_value, last_payout vs cashout_time — matching legacy condenser_api/objects.py:159-165. Add total_votes field. - PostLoader O(n²)→O(n): build a postMap for O(1) ID lookup instead of linear scan per ID (connection-pool-exhaustion Issue 3). - LoadPostsReblogs N+1: batch-load all reblogger account names in one query instead of per-pair (was N queries for N reblogged posts). - Add repToRaw, formatAmount, hydrateActiveVotes, payoutDate helpers with unit tests. These functions are reused by load_posts_keyed (PR#5b) and get_discussion (PR#5c).
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.
Summary
First step of the get_discussion gray-release milestone (solving the production connection-pool exhaustion incidents). Makes
buildPostObjectproduce condenser-compatible output by implementing the three TODO stubs that previously returned empty/wrong data.Changes
active_votes parsing (was
[]interface{}{}TODO)hive_posts_cache.votesCSV (format:voter,rshares,percent,reputationper line) into steemd-style vote objects.repToRaw(mirrors legacy_hydrate_active_votes+rep_to_raw).payout branches (was
cache.Payoutfor both — wrong)is_paidoutbranch:total_payout_valuevspending_payout_value,last_payoutvscashout_time.condenser_api/objects.py:159-165.total_votesfield.N+1 fixes (connection-pool-exhaustion Issues 3 & from objects audit)
postMapfor O(1) ID lookup instead of linear scan per ID.Helpers + tests
repToRaw,formatAmount,hydrateActiveVotes,payoutDate— all unit-tested.utils/normalize.py:rep_to_rawandcondenser_api/objects.py:_amount.Validation
go build/go vet/go test ./...all green.Why this matters
These functions are the building blocks reused by
load_posts_keyed(PR#5b) andget_discussion(PR#5c). Withoutactive_votesand correctpayout, the api-comparison tool flags every post-returning method as a mismatch.Test plan
Part of the get_discussion gray-release milestone. Depends on #381 (test infra, already merged).