coollsd commited on
Commit
410992d
·
verified ·
1 Parent(s): 1150bc4

Update ccc.py

Browse files
Files changed (1) hide show
  1. ccc.py +6 -10
ccc.py CHANGED
@@ -123,6 +123,7 @@ def generate_ids_batch(digit, batch_size=10000):
123
  offset = random.randint(-1000000, 1000000)
124
  ids_batch = [str(last_used_id + offset + i) for i in range(batch_size)]
125
  last_used_ids[digit] += batch_size
 
126
  return ids_batch
127
 
128
  async def run_scanner_instance(digit):
@@ -133,13 +134,13 @@ async def run_scanner_instance(digit):
133
 
134
  async def print_status_periodically():
135
  while True:
136
- print("Still working...")
137
- await asyncio.sleep(60) # Sleep for 60 seconds (1 minute)
138
 
139
  def run_scanner_in_process(digit):
140
  asyncio.run(run_scanner_instance(digit))
141
 
142
- async def main():
143
  initialize_base_ids()
144
  processes = []
145
  instances_per_digit = 20000
@@ -150,12 +151,7 @@ async def main():
150
  processes.append(process)
151
  process.start()
152
 
153
- status_task = asyncio.create_task(print_status_periodically())
154
-
155
- try:
156
- await asyncio.gather(status_task)
157
- except asyncio.CancelledError:
158
- pass
159
 
160
  for process in processes:
161
- process.join()
 
123
  offset = random.randint(-1000000, 1000000)
124
  ids_batch = [str(last_used_id + offset + i) for i in range(batch_size)]
125
  last_used_ids[digit] += batch_size
126
+ print(f"Generated batch for digit {digit} (first 4 IDs): {ids_batch[:4]} with offset {offset}")
127
  return ids_batch
128
 
129
  async def run_scanner_instance(digit):
 
134
 
135
  async def print_status_periodically():
136
  while True:
137
+ print("Working")
138
+ await asyncio.sleep(60)
139
 
140
  def run_scanner_in_process(digit):
141
  asyncio.run(run_scanner_instance(digit))
142
 
143
+ if __name__ == "__main__":
144
  initialize_base_ids()
145
  processes = []
146
  instances_per_digit = 20000
 
151
  processes.append(process)
152
  process.start()
153
 
154
+ asyncio.run(print_status_periodically())
 
 
 
 
 
155
 
156
  for process in processes:
157
+ process.join()