@@ -118,6 +118,11 @@ async def run(self) -> None:
118
118
clock = time .monotonic
119
119
start = clock ()
120
120
121
+ last_generation = - 1
122
+ clock = time .monotonic
123
+ last_time = clock ()
124
+ all_times : dict [int , float ] = {}
125
+
121
126
task = create_referenced_task (
122
127
insert_from_delta_file (
123
128
data_store = data_store ,
@@ -133,7 +138,6 @@ async def run(self) -> None:
133
138
downloader = None ,
134
139
)
135
140
)
136
- last_generation = - 1
137
141
try :
138
142
while not task .done ():
139
143
try :
@@ -143,8 +147,21 @@ async def run(self) -> None:
143
147
raise
144
148
else :
145
149
if generation != last_generation :
150
+ delta_generation = generation - last_generation
151
+ now = clock ()
152
+ delta_time = now - last_time
153
+ per_generation = delta_time / delta_generation
154
+
155
+ print_date (
156
+ f"synced: { last_generation } -> { generation } at { per_generation :.1f} s / gen" ,
157
+ flush = True ,
158
+ )
159
+
160
+ for i in range (generation , last_generation , - 1 ):
161
+ all_times [i ] = per_generation
162
+
146
163
last_generation = generation
147
- print_date ( f"synced to: { generation } " )
164
+ last_time = now
148
165
await asyncio .sleep (1 )
149
166
except asyncio .CancelledError :
150
167
with anyio .CancelScope (shield = True ):
@@ -161,6 +178,8 @@ async def run(self) -> None:
161
178
print (f" store id: { self .store_id } " )
162
179
print (f" reached: { self .generation_limit } " )
163
180
print (f" duration: { days } d { hours } h { minutes } m { seconds } s" )
181
+ generation , duration = max (all_times .items (), key = lambda item : item [1 ])
182
+ print (f" max: { generation } -> { duration :.1f} s" )
164
183
finally :
165
184
with anyio .CancelScope (shield = True ):
166
185
await self .run_chia ("stop" , "-d" , "all" , check = False )
0 commit comments