diff --git a/bubble-server/src/main/java/bubble/dao/bill/AccountPlanDAO.java b/bubble-server/src/main/java/bubble/dao/bill/AccountPlanDAO.java index 43ac6a47..87311c64 100644 --- a/bubble-server/src/main/java/bubble/dao/bill/AccountPlanDAO.java +++ b/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 { public static final long PURCHASE_DELAY = SECONDS.toMillis(3); diff --git a/bubble-server/src/main/java/bubble/service/cloud/StandardNetworkService.java b/bubble-server/src/main/java/bubble/service/cloud/StandardNetworkService.java index c7fce384..cc8b0d08 100644 --- a/bubble-server/src/main/java/bubble/service/cloud/StandardNetworkService.java +++ b/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"); }