Skip to content

fix: retain IPDB readers and rate limiter keys - #1204

Closed
qwqcode wants to merge 1 commit into
masterfrom
codex/docs-recommend-ipdb
Closed

qwqcode wants to merge 1 commit into
masterfrom
codex/docs-recommend-ipdb

Conversation

@qwqcode

@qwqcode qwqcode commented Oct 28, 2026 •

Copy link
Copy Markdown
Member

Disabling the global cache previously made every IPDB lookup reload the entire database file. Keep the IPDB reader in memory after the first successful load regardless of cache.enabled, while preserving XDB's existing memory/file behavior. Failed loads can still retry, and reinitializing the service loads a replacement database.

Recommend qqwry standard IPDB first in both language guides, update the example path, and explain its reader lifetime. Retain the XDB setup instructions and remove the paragraph about separate IPv4/IPv6 files. No new configuration fields or dependencies are introduced.

Copy rate limiter keys before retaining them: Fiber may reuse the request buffer backing an IP string after a request ends. Retaining that borrowed string could lose an IP's quota after another request, affecting page creation and notification-read limits. A deterministic regression test covers buffer reuse and independent IP quotas.

Validation: CGO_ENABLED=0 go test -coverprofile=/tmp/artalk-1204-ci-coverage.out ./..., go vet ./..., go test -race ./internal/limiter ./server/handler, go test -race ./internal/ip_region ./internal/core, and Prettier checks for both guides passed. The new limiter regression test failed before the fix and passed 100 consecutive runs after it. IPDB regression coverage includes cache disabled/enabled, uppercase .IPDB, concurrent lookups, failed-load retry, file replacement, service reinitialization, and unchanged XDB behavior.

@qwqcode
qwqcode force-pushed the codex/docs-recommend-ipdb branch from 8575f9b to af9033b Compare October 28, 2026 14:42
@qwqcode qwqcode changed the title docs(ip-region): recommend standard IPDB databases fix(ip-region): reuse IPDB readers when caching is disabled Oct 28, 2026
@qwqcode
qwqcode force-pushed the codex/docs-recommend-ipdb branch from af9033b to 62c8df6 Compare October 28, 2026 14:47
@qwqcode qwqcode changed the title fix(ip-region): reuse IPDB readers when caching is disabled fix: retain IPDB readers and rate limiter keys Oct 28, 2026
@qwqcode qwqcode closed this Oct 28, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant