Closed LeeC20 closed 10 months ago
你这个写代码方式很奇怪啊,为什么要get_publisher呢?不推荐这么写代码。
你可以可以看看,BoosterManager的get_booster方法。不建议调用get_publisher。
非装饰器方式文档也写了,不建议跳过booster类。
好 我试一下
确实没问题。看来确实不能跳过boost类
这是很基础的知识啊,字典和列表是python的可变对象,funboost的函数直接修改了字典了,你把var字典初始化放到 for循环里面就可以了.
python的可变对象和不可变对象,你应该听说过吧
学习下什么是python可变对象吧
下个版本我改下吧,我自己在publish方法内部copy一下,这样不影响用户自身的传参.
如果你不想用@boost装饰器,可以看看 BoostersManager里面的方法,包括 build_booster 和 get_or_create_booster_by_queue_name
当我这样发publish的时候。
`
`
第一条数据是这样,
`
` 但是第二条就有问题了
`
`
直接新增了一个extra。所以要怎么避免这种情况。
源码在base_publisher