Comments (3)
这种情况是考虑是回滚redis数据还是增加ack时间。感觉都不是太好。盼回复
from jseckill.
我觉得应该回滚redis数据。 毕竟增加ack时间,这个会导致mq消息大量积压,拖垮系统。
from jseckill.
这里我也发现是有bug的,因为浏览器是通过接口去轮询,而作者写的轮询接口逻辑是这样的:1、先查看秒杀成功的商品set集合中是否存在用户手机号,存在,返回秒杀成功。不存在,则判断redis中推送成功的消息set集合,这里是重点!当你ack超时,但是却成功推送到了MQ中,将不会记录到Redis中!于是在redis中找不到推送成功的记录(实际上已经推送成功了),于是给浏览器返回秒杀失败,但是实际上已经成功了!这是问题所在,解决这个问题有我觉得有这些方法,1、完善这个请求秒杀状态的接口,及时将推送成功信息写入redis中。2、适当增加等待ack的时间,如指数退避算法。3、没有接收到ack请求的,一律忽略,不进行后面的逻辑处理,这样返回秒杀失败也合情合理
from jseckill.
Related Issues (18)
- ACK队列在项目中作用 HOT 1
- demo HOT 1
- 请问为什么updateInventory没有函数调用他 HOT 1
- 关于mysql读写分离
- RabbitMQ问题
- 请问一下,库存存入redis的代码是那部分呢
- 请删除无效字符
- rabbitmq的生产和消费是只用了一个队列吗? HOT 9
- 如果半小时不付款,后续代码是监听redis的key实现,还是用zookeeper
- 先插入秒杀记录再减库存 updateInventory 方法 HOT 4
- 秒杀成功后,Redis中库存会更新,但数据库中没有记录,库存也未更新。
- 最新的小程序约苗有个加签的参数,请问一下你原来是怎么知道md5的盐值呢?
- 项目 jseckill.appjishu.com 被劫持,打开是黄色链接
- 这一行代码不多余吗?
- 如果希望采用多个服务器进行消息的消费,是不是在操作redis减库存的时候加分布式锁呢? HOT 2
- 客户端轮询秒杀是否成功,换成websocket是否更好
- 秒杀输入手机号问题 HOT 8
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from jseckill.