Add a method to clear all messages from a channel
还没有人认领这个 Issue。
评估
- 难度
- 4/5
- 预计耗时
- 3-5 天
- 新手友好度
- 45/100
- Issue 类型
- 功能
- 描述清晰度
- 基本清楚
- 活跃度
- 冷清
- 技术栈
- php, rabbitmq, redis
调研方向
先阅读 AdapterInterface 和现有的 push/status 入口,然后检查 Redis、AMQP 和内存适配器。解决 purge 与 clear 的命名问题以及 channel 签名问题;当 opt-in 接口和提议的适配器实现支持清空 channel 且不改变主接口时,即视为完成。
由索引模型根据 Issue 内容生成。
描述
Proposed new feature or change
There's no programmatic way to empty a queue. It comes up in three places:
- Maintenance - a
queue:purgecommand or an admin button to drop a queue that got flooded with poison pills or jobs that are no longer wanted. - Deployments - clearing a queue during a release when the payload structure changed and old queued jobs would crash on the new code.
- Testing - resetting state between runs. Shelling out to
redis-cliorrabbitmqctlmakes the test suite fragile and awkward to run in containerized CI.
I wouldn't put this on AdapterInterface - that would break every existing implementation and it overlaps with the "not the job of the primary interface" point from #271. A separate opt-in interface fits better:
interface PurgeableInterface
{
public function purge(): void;
}
Adapters implement it when the backend can do it cheaply (Redis drops the channel keys, AMQP calls queue_purge, the in-memory adapter resets its array). Callers check for it:
if ($adapter instanceof PurgeableInterface) {
$adapter->purge();
}
Open questions:
- Name:
purge()(broker vocabulary) orclear()? - Signature:
purge(): voidon the adapter's current channel (consistent withpush/status, which don't take a channel) orpurge(string $channel)?
Worth pursuing? Happy to send a PR if you're good with it (core + redis/amqp).
- 主要语言
- PHP
- 星标
- 61
- 派生
- 31
- 平均合并
- 1 天 7 小时
- 30 天内合并 PR
- 9
贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
yiisoft/queue 的其他 Issue
-
难度 4/5 3-5 天 新手友好度 56/100
-
难度 4/5 3-5 天 新手友好度 45/100
-
难度 5/5 一周以上 新手友好度 35/100
-
status:ready for adoption type:test
相似的 Issue
-
status/awaiting_triage
难度 2/5 1-3 小时 新手友好度 75/100
-
难度 1/5 1 小时以内 新手友好度 90/100
WordPress/plugin-check#1486 ·
-
enhancement
难度 2/5 1-3 小时 新手友好度 88/100
az-digital/az_quickstart#6019 ·
-
难度 2/5 1-3 小时 新手友好度 75/100
grokability/snipe-it#19688 ·
-
难度 2/5 1-3 小时 新手友好度 85/100