所有服务追加400ms处理时间

master
Administrator 3 years ago
parent 2ea1632b32
commit 2ea03363d1

@ -1,10 +1,10 @@
server:
port: 80
port: 80
spring:
application:
name: placeorder
cloud:
nacos:
discovery:
server-addr: 114.116.226.76:8848
spring:
application:
name: placeorder
cloud:
nacos:
discovery:
server-addr: 114.116.226.76:8848

@ -13,7 +13,8 @@ public class ItemStockController {
private static int stock = 10;
@GetMapping("/decr")
public void decr(){
public void decr() throws InterruptedException {
Thread.sleep(400);
stock--;
if(stock < 0){
throw new RuntimeException("商品库存不足!");

@ -11,7 +11,8 @@ import org.springframework.web.bind.annotation.RestController;
public class OrderManageController {
@GetMapping("create")
public void create(){
public void create() throws InterruptedException {
Thread.sleep(400);
System.out.println("创建订单成功!");
}

@ -11,7 +11,8 @@ import org.springframework.web.bind.annotation.RestController;
public class CouponController {
@GetMapping("/coupon")
public void coupon(){
public void coupon() throws InterruptedException {
Thread.sleep(400);
System.out.println("优惠券预扣除成功!");
}

@ -11,7 +11,8 @@ import org.springframework.web.bind.annotation.RestController;
public class UserPointsController {
@GetMapping("/up")
public void up(){
public void up() throws InterruptedException {
Thread.sleep(400);
System.out.println("扣除用户积分成功!!");
}

@ -11,7 +11,8 @@ import org.springframework.web.bind.annotation.RestController;
public class BusinessController {
@GetMapping("/notify")
public void notifyBusiness(){
public void notifyBusiness() throws InterruptedException {
Thread.sleep(400);
System.out.println("通知商家成功!!");
}

Loading…
Cancel
Save