-
Notifications
You must be signed in to change notification settings - Fork 1.5k
Fix paginations #1603
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix paginations #1603
Conversation
|
""" WalkthroughThe changes update the pagination logic in the Hunter and Quake source modules. Both modules now correctly iterate through paginated API results by dynamically adjusting the page or start parameters in their respective requests, ensuring all available data is retrieved instead of only the first page. Changes
Sequence Diagram(s)sequenceDiagram
participant SubscrapingModule
participant HunterAPI
participant QuakeAPI
SubscrapingModule->>HunterAPI: GET /api/search?domain=...&page=currentPage
loop For each page (Hunter)
HunterAPI-->>SubscrapingModule: Return paginated results
SubscrapingModule->>HunterAPI: GET next page
end
SubscrapingModule->>QuakeAPI: POST /quake_service with start, size params
loop For each page (Quake)
QuakeAPI-->>SubscrapingModule: Return paginated results
SubscrapingModule->>QuakeAPI: POST next page (increment start)
end
Assessment against linked issues
Assessment against linked issues: Out-of-scope changes
Suggested reviewers
Poem
📜 Recent review detailsConfiguration used: CodeRabbit UI 📒 Files selected for processing (1)
🚧 Files skipped from review as they are similar to previous changes (1)
⏰ Context from checks skipped due to timeout of 90000ms (4)
✨ Finishing Touches
🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
SupportNeed help? Create a ticket on our support page for assistance with any issues or questions. Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (Invoked using PR comments)
Other keywords and placeholders
CodeRabbit Configuration File (
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 1
🔭 Outside diff range comments (1)
v2/pkg/subscraping/sources/hunter/hunter.go (1)
59-61: Wrong divisor ⇒ most pages never queried
page_sizeis fixed at 100 in the request, but the page‐count is derived withresponse.Data.Total/1000.
For any data-set larger than 100 records the loop will stop far too early (e.g. 250 items ⇒ 1 page instead of 3).- var pages = 1 + const pageSize = 100 + var pages = 1 ... - pages = int(response.Data.Total/1000) + 1 + pages = (response.Data.Total + pageSize - 1) / pageSize // ceil divisionAlso remember to pass
pageSizeinto the URL:- &page_size=100& + &page_size=%d&Failing to fix this silently drops large portions of the result-set.
Also applies to: 96-97
🧹 Nitpick comments (1)
v2/pkg/subscraping/sources/hunter/hunter.go (1)
59-64: Minor: avoid redundant base64 encoding inside the loop
qbase64depends only on the domain and can be pre-computed once before the loop to save a tiny amount of CPU per page.- for currentPage := 1; currentPage <= pages; currentPage++ { - qbase64 := base64.URLEncoding.EncodeToString([]byte(fmt.Sprintf("domain=\"%s\"", domain))) + qbase64 := base64.URLEncoding.EncodeToString([]byte(fmt.Sprintf("domain=\"%s\"", domain))) + for currentPage := 1; currentPage <= pages; currentPage++ {
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (2)
v2/pkg/subscraping/sources/hunter/hunter.go(1 hunks)v2/pkg/subscraping/sources/quake/quake.go(1 hunks)
🧰 Additional context used
🧬 Code Graph Analysis (1)
v2/pkg/subscraping/sources/quake/quake.go (2)
v2/pkg/subscraping/types.go (3)
Result(81-86)Error(94-94)Subdomain(93-93)v2/pkg/subscraping/sources/anubis/anubis.go (1)
Source(16-20)
⏰ Context from checks skipped due to timeout of 90000ms (1)
- GitHub Check: release-test
🔇 Additional comments (1)
v2/pkg/subscraping/sources/hunter/hunter.go (1)
63-63: Dynamic page parameter – good catchReplacing the hard-coded
1withcurrentPagefinally enables real pagination.
|
lint errs fixed in #1601 |
ehsandeep
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
merge conflict
* fix quake pagination * update page param * skip empty * fix test * minor
* fix quake pagination * update page param * skip empty * fix test * minor
Closes #1602
Summary by CodeRabbit