-
-
Notifications
You must be signed in to change notification settings - Fork 2k
MultiKeyPollingIndex 需要继承否则会导致轮询索引重置,影响多key轮询的正确性 #1744
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
MultiKeyPollingIndex 需要继承否则会导致轮询索引重置,影响多key轮询的正确性 #1744
Conversation
…MultiKeyPollingIndex 需要继承 // 否则会导致轮询索引重置,影响多key轮询的正确性
WalkthroughA loop was added in InitChannelCache to copy ChannelInfo.MultiKeyPollingIndex from existing cached channels to newly built cache entries by matching IDs. This preserves the polling index state across cache refreshes without changing public interfaces. Changes
Sequence Diagram(s)sequenceDiagram
autonumber
actor Caller
participant Cache as ChannelCache
participant Store as BackendStore
Caller->>Cache: InitChannelCache()
Cache->>Store: Load channels/groups
Store-->>Cache: newChannelId2channel, newGroup2model2channels
rect rgb(235, 245, 255)
note over Cache: Preserve polling index
Cache->>Cache: For each channelID in new cache
Cache->>Cache: If channelID exists in old cache<br/>copy MultiKeyPollingIndex
end
Cache-->>Caller: Updated cache with preserved indices
Estimated code review effort🎯 2 (Simple) | ⏱️ ~10 minutes Poem
✨ Finishing Touches
🧪 Generate unit tests
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
SupportNeed help? Create a ticket on our support page for assistance with any issues or questions. CodeRabbit Commands (Invoked using PR/Issue comments)Type 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
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
💡 Knowledge Base configuration:
- MCP integration is disabled by default for public repositories
- Jira integration is disabled by default for public repositories
- Linear integration is disabled by default for public repositories
You can enable these sources in your CodeRabbit configuration.
📒 Files selected for processing (1)
model/channel_cache.go
(1 hunks)
🧰 Additional context used
🧬 Code graph analysis (1)
model/channel_cache.go (1)
model/channel.go (1)
ChannelInfo
(51-57)
缓存开启时轮训key,数据库index不会更新,这些都在缓存里运作的,不需要从数据库里去读取状态 |
是有个定时任务,定时从数据库同步到缓存,然后将缓存的index 覆盖成了0,倒是轮询的时候,本来轮询到5,然后同步后立马跳回0,导致前几个key使用最为频繁,我看到key好像是一分钟同步一次,同步后就算后面还有很多的key也是继续从0开始。然后改动的逻辑是从数据库同步的时候,只是将老的index继续存在缓存延续 |
…MultiKeyPollingIndex 需要继承否则会导致轮询索引重置,影响多key轮询的正确性
Summary by CodeRabbit