Skip to content

Commit

Permalink
some streamlining
Browse files Browse the repository at this point in the history
  • Loading branch information
hpk42 committed Nov 20, 2023
1 parent 8626598 commit 4400a39
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 4 deletions.
3 changes: 3 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -11,3 +11,6 @@ dependencies = [
"click"
]
version = "0.1"

[project.scripts]
pingpong = "pingpong.__main__:pingpong"
12 changes: 9 additions & 3 deletions src/pingpong/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -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")
Expand All @@ -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

Expand Down Expand Up @@ -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):
Expand Down
2 changes: 1 addition & 1 deletion stat.pl
Original file line number Diff line number Diff line change
Expand Up @@ -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]
}
Expand Down

0 comments on commit 4400a39

Please sign in to comment.