Conversation
Codecov Report❌ Patch coverage is
@@ Coverage Diff @@
## main #399 +/- ##
==========================================
+ Coverage 62.65% 63.64% +0.98%
==========================================
Files 209 210 +1
Lines 5278 5328 +50
==========================================
+ Hits 3307 3391 +84
+ Misses 1869 1833 -36
- Partials 102 104 +2
Flags with carried forward coverage won't be shown. Click here to find out more.
🚀 New features to boost your workflow:
|
There was a problem hiding this comment.
Pull request overview
This PR enhances the Umeng push notification capability by introducing support for multiple vendor push channels (OPPO, VIVO, Xiaomi, Huawei, etc.), splitting the Policy struct into AndroidPolicy and IOSPolicy, and replacing synchronous in-line rate limiting (time.Sleep) with a new asynchronous single-goroutine dispatcher (asyncDispatcher) that enforces both per-message interval and daily quotas globally.
Changes:
- Async dispatcher with rate limiting:
pkg/umeng/dispatcher.gointroduces a singletonasyncDispatcherwith a queue, per-message interval control (1 min), and a daily send quota (500/day), replacing the previous blockingtime.Sleepapproach. - Extended model and groupcast API:
pkg/umeng/model.goandgroupcast.goadd new vendor channel properties (OPPO private templates, Huawei, VIVO, Xiaomi, local channel), splitPolicyintoAndroidPolicy/IOSPolicy, and remove app key/secret parameters from public API (now read from config). - Updated callers:
internal/academic/service/get_scores.go,internal/course/service/get_course_list.go, andcmd/common/main.goare updated to useEnqueueAsyncand the new function signatures.
Reviewed changes
Copilot reviewed 9 out of 9 changed files in this pull request and generated 7 comments.
Show a summary per file
| File | Description |
|---|---|
pkg/umeng/dispatcher.go |
New async dispatcher with queue, interval, and daily-limit rate control |
pkg/umeng/model.go |
Added vendor channel properties structs, split Policy into Android/iOS variants |
pkg/umeng/groupcast.go |
Updated send functions to read config directly; added vendor channel properties |
pkg/constants/umeng.go |
New constants for queue size, daily limit; rate limit delay raised to 1 min |
config/types.go |
New oppo, huawei, localProperties, and updated vendors config structs |
internal/academic/service/get_scores.go |
Switched to EnqueueAsync; simplified sendNotifications |
internal/academic/service/get_scores_test.go |
Updated test tag to be long enough for tag[:12] slicing |
internal/course/service/get_course_list.go |
Switched to EnqueueAsync; simplified sendNotifications |
cmd/common/main.go |
Switched notice push to EnqueueAsync |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
|
Code Review: fix/push 分支 本次 PR 的核心目标是将友盟推送从同步阻塞 + time.Sleep 限流改造为异步队列 + 调度器限流,并适配 OPPO/荣耀/vivo/小米/华为的私信渠道配置。整体方向正确,架构改进明显。
// 方案二:条件构造(推荐,无需改动 model)
总结与总体评价 有部分重要问题需要修复后再合并。 本次 PR 的架构改进思路是正确的——用异步队列替代同步阻塞 + sleep,并统一了厂商推送配置的管理方式。代码注释完善,dispatcher.go 设计清晰。 核心需要修复的问题是:
其余问题优先级较低,可在后续迭代中处理。 |
自查 PR 结构
PR 标题符合这个格式: <type>(optional scope): <description>
此 PR 标题的描述以用户为导向,足够清晰,其他人可以理解。
我已经对所有 commit 提供了签名(GPG 密钥签名、SSH 密钥签名)
这个 PR 属于强制变更/破坏性更改
这个 PR 的类型是什么?
feat
这个 PR 做了什么 / 我们为什么需要这个 PR?
(可选)这个 PR 解决了哪个/些 issue?
对 Reviewer 预留的一些提醒