-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcoret.txt
48 lines (36 loc) · 1.11 KB
/
coret.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
==========================
> API: http bidding
- double request TTL
- get bid collection (user id, product id)
- bidded balance sum
- check balance query ke user get blanace (current bid - bidded balance)
- message "wow balance invalid"
- deduct balance
- publish NSQ topic A: update redis
- publish NSQ topic B: insert payment
- return front end
> TOPIC UpdateScoreBoard (func CheckHighestBid)
- check redis current highest bid / leaderboard
- update current highest bid / leaderboard
- ctx.finish (krn maxinflight 1)
> TOPIC B
- create payment
- create bid_collection
=============================
> CRON: stop auction
- get all auction where timewindow expired (join query)
- publish topic C
> TOPIC C: deactivate Auction
- deactivate Auction list
=============================
Redis use cases
- (new entry) ZADD --> ZADD BID [BID_VALUE] [USER_ID]
- (get top) ZREVRANGE currentBid 0 0 withscores
- no TTL; pas cron sweeping auction (deactivate) jalan, del key
-
- user_id, sort
// seller
- get ke product (param user id)
- get auction (param product id)
// buyer
- get bid (without param, get all)