Skip to content

Commit

Permalink
fix(bot): logging about unexpected blocker (#417)
Browse files Browse the repository at this point in the history
When the seats_exceeded subscription blocker was set and the user was an allowed user we would erroneously log a warning about an unexpected subscription status.
  • Loading branch information
chdsbd authored Jun 6, 2020
1 parent 7a12a93 commit 9c187ee
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions bot/kodiak/evaluation.py
Original file line number Diff line number Diff line change
Expand Up @@ -233,6 +233,7 @@ def missing_push_allowance(push_allowances: List[PushAllowance]) -> bool:
def get_paywall_status_for_blocker(
pull_request: PullRequest,
subscription_blocker: Union[SubscriptionExpired, TrialExpired, SeatsExceeded],
log: structlog.BoundLogger,
) -> Optional[str]:
if isinstance(subscription_blocker, SeatsExceeded):
if pull_request.author.databaseId in subscription_blocker.allowed_user_ids:
Expand All @@ -242,6 +243,7 @@ def get_paywall_status_for_blocker(
return "trial ended"
if isinstance(subscription_blocker, SubscriptionExpired):
return "subscription expired"
log.warning("unexpected subscription_blocker %s ", subscription_blocker)
return None


Expand Down Expand Up @@ -379,17 +381,14 @@ async def set_status(msg: str, markdown_content: Optional[str] = None) -> None:
# We also ignore missing subscriptions. The web api will set
# subscription blockers if usage exceeds limits.
status_message = get_paywall_status_for_blocker(
pull_request, subscription.subscription_blocker
pull_request, subscription.subscription_blocker, log
)
if status_message is not None:
await set_status(
f"💳 subscription: {status_message}",
markdown_content=get_markdown_for_paywall(),
)
return
log.warning(
"unexpected subscription_blocker %s ", subscription.subscription_blocker
)

if (
pull_request.author.login in config.approve.auto_approve_usernames
Expand Down

0 comments on commit 9c187ee

Please sign in to comment.