Skip to content

Commit 73c2c57

Browse files
committed
Add validator for more than 10 tokens
1 parent 4a616c4 commit 73c2c57

1 file changed

Lines changed: 15 additions & 0 deletions

File tree

olli/config.py

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,21 @@ def must_be_above_zero(cls, value: int) -> int:
7272

7373
return value
7474

75+
@validator("tokens")
76+
def warn_above_ten(cls, value: list[TokenConfig]) -> list[TokenConfig]:
77+
"""
78+
Warn a user if they have more than 10 tokens.
79+
80+
This is because we cannot handle more than 10 token triggers at once until we
81+
batch triggers into groups of 10 to distribute to the webhook.
82+
"""
83+
if len(value) > 10:
84+
logger.warning(
85+
"More than 10 token triggers in one period cannot be handled, be careful."
86+
)
87+
88+
return value
89+
7590

7691
class OlliConfig(BaseModel):
7792
"""Class representing root Olli config."""

0 commit comments

Comments
 (0)