mirror of
				https://github.com/blakeblackshear/frigate.git
				synced 2025-10-27 10:52:11 +01:00 
			
		
		
		
	Improve reindex completion flag (#14308)
This commit is contained in:
		
							parent
							
								
									3a403392e7
								
							
						
					
					
						commit
						0fc7999780
					
				@ -176,6 +176,7 @@ class Embeddings:
 | 
				
			|||||||
            "processed_objects": 0,
 | 
					            "processed_objects": 0,
 | 
				
			||||||
            "total_objects": 0,
 | 
					            "total_objects": 0,
 | 
				
			||||||
            "time_remaining": 0,
 | 
					            "time_remaining": 0,
 | 
				
			||||||
 | 
					            "status": "indexing",
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        self.requestor.send_data(UPDATE_EMBEDDINGS_REINDEX_PROGRESS, totals)
 | 
					        self.requestor.send_data(UPDATE_EMBEDDINGS_REINDEX_PROGRESS, totals)
 | 
				
			||||||
@ -255,6 +256,8 @@ class Embeddings:
 | 
				
			|||||||
            "Embedded %d thumbnails and %d descriptions in %s seconds",
 | 
					            "Embedded %d thumbnails and %d descriptions in %s seconds",
 | 
				
			||||||
            totals["thumbnails"],
 | 
					            totals["thumbnails"],
 | 
				
			||||||
            totals["descriptions"],
 | 
					            totals["descriptions"],
 | 
				
			||||||
            time.time() - st,
 | 
					            round(time.time() - st, 1),
 | 
				
			||||||
        )
 | 
					        )
 | 
				
			||||||
 | 
					        totals["status"] = "completed"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        self.requestor.send_data(UPDATE_EMBEDDINGS_REINDEX_PROGRESS, totals)
 | 
					        self.requestor.send_data(UPDATE_EMBEDDINGS_REINDEX_PROGRESS, totals)
 | 
				
			||||||
 | 
				
			|||||||
@ -195,13 +195,18 @@ export default function Explore() {
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
  const { payload: reindexProgress } = useEmbeddingsReindexProgress();
 | 
					  const { payload: reindexProgress } = useEmbeddingsReindexProgress();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  const embeddingsReindexing = useMemo(
 | 
					  const embeddingsReindexing = useMemo(() => {
 | 
				
			||||||
    () =>
 | 
					    if (reindexProgress) {
 | 
				
			||||||
      reindexProgress
 | 
					      switch (reindexProgress.status) {
 | 
				
			||||||
        ? reindexProgress.total_objects - reindexProgress.processed_objects > 0
 | 
					        case "indexing":
 | 
				
			||||||
        : undefined,
 | 
					          return true;
 | 
				
			||||||
    [reindexProgress],
 | 
					        case "completed":
 | 
				
			||||||
  );
 | 
					          return false;
 | 
				
			||||||
 | 
					        default:
 | 
				
			||||||
 | 
					          return undefined;
 | 
				
			||||||
 | 
					      }
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					  }, [reindexProgress]);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  // model states
 | 
					  // model states
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@ -320,7 +325,8 @@ export default function Explore() {
 | 
				
			|||||||
                    <span className="text-primary-variant">
 | 
					                    <span className="text-primary-variant">
 | 
				
			||||||
                      Tracked objects processed:
 | 
					                      Tracked objects processed:
 | 
				
			||||||
                    </span>
 | 
					                    </span>
 | 
				
			||||||
                    {reindexProgress.processed_objects}
 | 
					                    {reindexProgress.processed_objects} /{" "}
 | 
				
			||||||
 | 
					                    {reindexProgress.total_objects}
 | 
				
			||||||
                  </div>
 | 
					                  </div>
 | 
				
			||||||
                </div>
 | 
					                </div>
 | 
				
			||||||
              </>
 | 
					              </>
 | 
				
			||||||
 | 
				
			|||||||
@ -68,6 +68,7 @@ export type EmbeddingsReindexProgressType = {
 | 
				
			|||||||
  processed_objects: number;
 | 
					  processed_objects: number;
 | 
				
			||||||
  total_objects: number;
 | 
					  total_objects: number;
 | 
				
			||||||
  time_remaining: number;
 | 
					  time_remaining: number;
 | 
				
			||||||
 | 
					  status: string;
 | 
				
			||||||
};
 | 
					};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
export type ToggleableSetting = "ON" | "OFF";
 | 
					export type ToggleableSetting = "ON" | "OFF";
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
		Reference in New Issue
	
	Block a user