Skip to content

perf: make data size calculation async for disable/uninstall responses #814

@yasinBursali

Description

@yasinBursali

Context

The _get_service_data_info() helper (added in #812) calls dir_size_gb() synchronously during disable/uninstall API responses. dir_size_gb() does a full recursive rglob("*") scan which could take several seconds on large data directories (e.g., ComfyUI models with tens of GB and thousands of files).

Problem

The disable/uninstall response is delayed by the directory scan. For a 50GB data directory with 10K+ files, this could add 2-5 seconds to what should be a fast operation.

Proposed Solution

Options (pick one):

  1. Background annotation: Return the disable/uninstall response immediately, fire off an async task to compute data_info, and make it available via a separate GET /api/extensions/{id}/data-info endpoint
  2. Cached size: Pre-compute and cache directory sizes periodically (e.g., every 60s), return the cached value in disable/uninstall responses
  3. Opt-in parameter: Add ?include_data_info=true query param, skip the scan by default

Priority

Low — affects UX only for services with very large data directories. The current synchronous approach works correctly for all services.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions