当前位置:网站首页>Summary of advertisement business bug replay
Summary of advertisement business bug replay
2022-07-02 06:26:00 【dotaer-df】
Because of the company's business adjustment , Recently took over the business of the company's advertising system , One of them encountered such a Bug, Its appearance is like this : There is no money in the advertiser's account , But the advertisement still put it on him .
One 、 Basic business logic
First of all, there are several ways to charge advertisements ,CPA,CPT,CPC,CPM etc. , and CPM This billing method is per 1000 Charge for each exposure x element , That is to say, if the unit price is 10 element , Then a single exposure is 0.01 element , For each exposure, we will first deduct the corresponding money from the cache balance of the advertising system , Deduct all the money , Will send a message to the account system , And then execute local things , Drop the deduction order , Submit sth , Then the account system will also record the deduction amount in the cache , If the account fails to deduct money , It will also send a message of failed deduction , After the advertising system receives this message , It will replenish the balance into its own cache .
Here is a point that I don't quite understand :
Why has the advertisement been exposed , But calling the account system to deduct money failed , It is necessary to make up the user's balance , For example, merchants have sold their goods , But the user failed to deduct money when paying , The balance is made up for the user again .
Two 、Bug spot
bug Just before the deduction failed , Make up the user's balance here , Because it is sending to the account system CPM A kind of advertising message , Will improve the accuracy 3, That is, the amount of a single exposure will * 1000 Send to the account system , When the account system fails to deduct money , Will be intact * 1000 Send the later unit price , And make up the user balance of the advertising system . Here's an example :
Assume user balance 1000, Single exposure 2 element ( Expensive, huh ~), After a single exposure , The user balance should be 998 element , But the account system failed to deduct money , Will make up the user's balance , because * 1000, promote 3 precision , The balance made up becomes 998 + 2 * 1000 = 2998
Pinduoduo doesn't bring how to play ...
That's what happened There is no money in the advertiser's account , But the advertisement still put it on him . Because the user cache balance of the advertising system is much larger than the balance of the account system , When the cache balance is less than 0 It will trigger an advertisement off the shelf , In this way, it will not be triggered , And because the account is out of money , The advertising system has been receiving the message of failed deduction , Crazy continue to fill the balance ...
3、 ... and 、 Remedial measures
1、 Precision processing : Contact the students of the account system , Add a precision to the message scale Field , Such as scale = 3, Corresponding to will amout / 1000
2、 The message of deduction failure is the message that the account balance is insufficient , Do not make up the balance 
Then I found that the code has such a comment , Then I'll do it to the end , By the way
// Pseudo code
Long setnx = redis.setnx( Business Key+ The only news id,"1"); redis.expire( Business Key+ The only news id,x); if(setnx == 0) return;
边栏推荐
- Redis - grande question clé
- eslint配置代码自动格式化
- LeetCode 78. subset
- 【每日一题】—华为机试01
- Contest3147 - game 38 of 2021 Freshmen's personal training match_ F: Polyhedral dice
- Summary of WLAN related knowledge points
- MySQL的10大经典错误
- 数据科学【八】:SVD(一)
- Three suggestions for all students who have graduated and will graduate
- Step by step | help you easily submit Google play data security form
猜你喜欢
随机推荐
LeetCode 83. 删除排序链表中的重复元素
队列(线性结构)
Contest3145 - the 37th game of 2021 freshman individual training match_ H: Eat fish
深入学习JVM底层(五):类加载机制
华为MindSpore开源实习机试题
The real definition of open source software
LeetCode 39. Combined sum
Contest3147 - game 38 of 2021 Freshmen's personal training match_ F: Polyhedral dice
Detailed explanation of BGP message
Contest3147 - game 38 of 2021 Freshmen's personal training match_ A: chicken
TensorRT的功能
ROS create workspace
Sentinel规则持久化到Nacos
LeetCode 39. 组合总和
IPv6 experiment and summary
Use of Arduino wire Library
Redis——Cluster数据分布算法&哈希槽
CUDA中的存储空间修饰符
一起学习SQL中各种join以及它们的区别
注解和反射详解以及运用
![Data science [9]: SVD (2)](/img/2c/f1a8c3ff34ff3f3cc6e26157a32bfd.png)







