Skip to content

fix metrics to check for "cur" mailbox instead of counting all subdirs #534

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Mar 27, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions chatmaild/src/chatmaild/metrics.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@ def main(vmail_dir=None):
ci_accounts = 0

for path in Path(vmail_dir).iterdir():
if not path.joinpath("cur").is_dir():
continue
accounts += 1
if path.name[:3] in ("ci-", "ac_"):
ci_accounts += 1
Expand Down
9 changes: 8 additions & 1 deletion chatmaild/src/chatmaild/tests/test_metrics.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,15 @@


def test_main(tmp_path, capsys):
paths = []
for x in ("ci-asllkj", "ac_12l3kj", "qweqwe", "ci-l1k2j31l2k3"):
tmp_path.joinpath(x).mkdir()
p = tmp_path.joinpath(x)
p.mkdir()
p.joinpath("cur").mkdir()
paths.append(p)

tmp_path.joinpath("nomailbox").mkdir()

main(tmp_path)
out, _ = capsys.readouterr()
d = {}
Expand Down