Sleep a bit between exploded messages

This commit is contained in:
Dan Buch 2021-02-16 23:16:08 -05:00
parent b5f9ffb700
commit 263b10b049
Signed by: meatballhat
GPG Key ID: 9685130D8B763EA7

View File

@ -3,6 +3,7 @@ import hashlib
import os
import pathlib
import sys
import time
import typing
DEBUG = os.environ.get("DEBUG") == "enabled"
@ -12,6 +13,13 @@ def main(sysargs=sys.argv[:]) -> int:
parser = argparse.ArgumentParser()
parser.add_argument("mbox", type=argparse.FileType("rb"))
parser.add_argument("output_directory", type=pathlib.Path)
parser.add_argument(
"-s",
"--zzz",
default=0.005,
type=float,
help="sleep seconds in between messages",
)
args = parser.parse_args(sysargs[1:])
@ -23,6 +31,7 @@ def main(sysargs=sys.argv[:]) -> int:
dest.parent.mkdir(parents=True, exist_ok=True)
print(f"writing message to {dest}")
dest.write_bytes(msg.as_bytes())
time.sleep(args.zzz)
return 0