From 4400a39f24faa5124e3bd96be19fdc29606d8c5b Mon Sep 17 00:00:00 2001 From: holger krekel Date: Mon, 20 Nov 2023 17:12:46 +0100 Subject: [PATCH] some streamlining --- pyproject.toml | 3 +++ src/pingpong/__init__.py | 12 +++++++++--- stat.pl | 2 +- 3 files changed, 13 insertions(+), 4 deletions(-) diff --git a/pyproject.toml b/pyproject.toml index be2f7ad..c394cf8 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -11,3 +11,6 @@ dependencies = [ "click" ] version = "0.1" + +[project.scripts] +pingpong = "pingpong.__main__:pingpong" diff --git a/src/pingpong/__init__.py b/src/pingpong/__init__.py index 6d29409..cdd6506 100644 --- a/src/pingpong/__init__.py +++ b/src/pingpong/__init__.py @@ -32,7 +32,6 @@ def make_accounts(num, account_maker): def create_account(api): account = api.add_account() - account.set_config("bot", "1") account.set_config("bcc_self", "0") account.set_config("mvbox_move", "0") @@ -51,7 +50,11 @@ def create_account(api): creds = get_temp_credentials() account.set_config("addr", creds["email"]) account.set_config("mail_pw", creds["password"]) + domain = creds["email"].split("@")[1] + account.set_config("mail_server", domain) + account.set_config("send_server", domain) account.configure() + # print(f"account configured {creds['email']}", file=sys.stderr) account.start_io() return account @@ -110,9 +113,12 @@ def __call__(self): def run(api, proc, num_pings): elapsed = Elapsed() - print(f"making {proc} accounts", file=sys.stderr) + print(f"making {proc} ping-accounts and {proc} pong-accounts", file=sys.stderr) accounts = make_accounts(proc * 2, lambda: create_account(api)) - print(f"{proc} accounts finished, took {elapsed}", file=sys.stderr) + speed = proc * 2 / elapsed() + print( + f"finished, took {elapsed} ({speed:0.02f} accounts per second)", file=sys.stderr + ) with concurrent.futures.ThreadPoolExecutor(max_workers=proc * 2) as executor: for i in range(proc): diff --git a/stat.pl b/stat.pl index e785526..aaf11d4 100755 --- a/stat.pl +++ b/stat.pl @@ -11,7 +11,7 @@ chomp $line; my @fields = split "," , $line; if (defined $prev) { - push(@values, $fields[1] - $prev) + push(@values, $fields[1]) } $prev = $fields[1] }