mirror of
https://github.com/comfyanonymous/ComfyUI.git
synced 2026-04-27 18:01:25 +00:00
Fix is_missing state updates for asset cache states on startup
- Add bulk_update_is_missing() to efficiently update is_missing flag - Update sync_cache_states_with_filesystem() to mark non-existent files as is_missing=True - Call restore_cache_states_by_paths() in batch_insert_seed_assets() to restore previously-missing states when files reappear during scanning Amp-Thread-ID: https://ampcode.com/threads/T-019c3177-e591-7666-ac6b-7e05c71c8ebf Co-authored-by: Amp <amp@ampcode.com>
This commit is contained in:
@@ -261,6 +261,21 @@ def bulk_update_needs_verify(session: Session, state_ids: list[int], value: bool
|
||||
return result.rowcount
|
||||
|
||||
|
||||
def bulk_update_is_missing(session: Session, state_ids: list[int], value: bool) -> int:
|
||||
"""Set is_missing flag for multiple cache states.
|
||||
|
||||
Returns: Number of rows updated
|
||||
"""
|
||||
if not state_ids:
|
||||
return 0
|
||||
result = session.execute(
|
||||
sa.update(AssetCacheState)
|
||||
.where(AssetCacheState.id.in_(state_ids))
|
||||
.values(is_missing=value)
|
||||
)
|
||||
return result.rowcount
|
||||
|
||||
|
||||
def delete_cache_states_by_ids(session: Session, state_ids: list[int]) -> int:
|
||||
"""Delete cache states by their IDs.
|
||||
|
||||
|
||||
Reference in New Issue
Block a user