소스 검색

fix wait for account enablement

tags/v0.1.6
Jonathan Cobb 4 년 전
부모
커밋
62856393f9
2개의 변경된 파일5개의 추가작업 그리고 3개의 파일을 삭제
  1. +2
    -1
      bubble-server/src/main/java/bubble/dao/bill/AccountPlanDAO.java
  2. +3
    -2
      bubble-server/src/main/java/bubble/service/cloud/StandardNetworkService.java

+ 2
- 1
bubble-server/src/main/java/bubble/dao/bill/AccountPlanDAO.java 파일 보기

@@ -13,6 +13,7 @@ import bubble.model.cloud.CloudService;
import bubble.notify.payment.PaymentValidationResult;
import bubble.server.BubbleConfiguration;
import bubble.service.bill.RefundService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Repository;

@@ -25,7 +26,7 @@ import static org.cobbzilla.util.system.Sleep.sleep;
import static org.cobbzilla.wizard.resources.ResourceUtil.invalidEx;
import static org.hibernate.criterion.Restrictions.*;

@Repository
@Repository @Slf4j
public class AccountPlanDAO extends AccountOwnedEntityDAO<AccountPlan> {

public static final long PURCHASE_DELAY = SECONDS.toMillis(3);


+ 3
- 2
bubble-server/src/main/java/bubble/service/cloud/StandardNetworkService.java 파일 보기

@@ -90,7 +90,7 @@ public class StandardNetworkService implements NetworkService {
private static final long NET_LOCK_TIMEOUT = MINUTES.toSeconds(21);
private static final long NET_DEADLOCK_TIMEOUT = MINUTES.toSeconds(20);
private static final long DNS_TIMEOUT = MINUTES.toMillis(60);
private static final long PLAN_ENABLE_TIMEOUT = PURCHASE_DELAY + SECONDS.toMillis(2);
private static final long PLAN_ENABLE_TIMEOUT = PURCHASE_DELAY + SECONDS.toMillis(10);

@Autowired private AccountDAO accountDAO;
@Autowired private BubbleNetworkDAO networkDAO;
@@ -463,11 +463,12 @@ public class StandardNetworkService implements NetworkService {

final String accountUuid = network.getAccount();
if (configuration.paymentsEnabled()) {
final AccountPlan accountPlan = accountPlanDAO.findByAccountAndNetwork(accountUuid, network.getUuid());
AccountPlan accountPlan = accountPlanDAO.findByAccountAndNetwork(accountUuid, network.getUuid());
if (accountPlan == null) throw invalidEx("err.accountPlan.notFound");
final long start = now();
while (accountPlan.disabled() && now() - start < PLAN_ENABLE_TIMEOUT) {
sleep(100, "startNetwork: waiting for accountPlan to become enabled: "+accountUuid);
accountPlan = accountPlanDAO.findByAccountAndNetwork(accountUuid, network.getUuid());
}
if (accountPlan.disabled()) throw invalidEx("err.accountPlan.disabled");
}


불러오는 중...
취소
저장