forked from Github/frigate
Add time remaining to embedding reindex pane (#14279)
* Add function to convert seconds to human readable duration * Add estimated time remaining to reindexing pane
This commit is contained in:
@@ -175,6 +175,7 @@ class Embeddings:
|
||||
"descriptions": 0,
|
||||
"processed_objects": 0,
|
||||
"total_objects": 0,
|
||||
"time_remaining": 0,
|
||||
}
|
||||
|
||||
self.requestor.send_data(UPDATE_EMBEDDINGS_REINDEX_PROGRESS, totals)
|
||||
@@ -229,6 +230,13 @@ class Embeddings:
|
||||
totals["descriptions"],
|
||||
)
|
||||
|
||||
# Calculate time remaining
|
||||
elapsed_time = time.time() - st
|
||||
avg_time_per_event = elapsed_time / totals["processed_objects"]
|
||||
remaining_events = total_events - totals["processed_objects"]
|
||||
time_remaining = avg_time_per_event * remaining_events
|
||||
totals["time_remaining"] = int(time_remaining)
|
||||
|
||||
self.requestor.send_data(UPDATE_EMBEDDINGS_REINDEX_PROGRESS, totals)
|
||||
|
||||
# Move to the next page
|
||||
|
||||
Reference in New Issue
Block a user