(path, write_count, interval)
| 107 | from tempfile import TemporaryDirectory |
| 108 | |
| 109 | def write_random_data(path, write_count, interval): |
| 110 | with open(path, "wb") as f: |
| 111 | for i in range(write_count): |
| 112 | time.sleep(random.random() * interval) |
| 113 | letters = random.choices(string.ascii_lowercase, k=10) |
| 114 | data = f'{path}-{i:02}-{"".join(letters)}\n' |
| 115 | f.write(data.encode()) |
| 116 | f.flush() |
| 117 | |
| 118 | def start_write_threads(directory, file_count): |
| 119 | paths = [] |