Skip to content

parallel

appimage_updater.core.parallel

Concurrent processing utilities for AppImage Updater.

ConcurrentProcessor()

Handles concurrent processing of application checks using async concurrency.

This processor uses asyncio.gather() to run multiple I/O-bound tasks concurrently, which is ideal for network operations like checking GitHub repositories for updates.

Source code in src/appimage_updater/core/parallel.py
def __init__(self) -> None:
    """Initialize the concurrent processor."""
    pass

process_items_async(items, async_worker_func, progress_callback=None) async

Process items using concurrent async tasks for I/O-bound operations.

Parameters:

Name Type Description Default
items list[Any]

List of items to process

required
async_worker_func Callable[[Any], Coroutine[Any, Any, Any]]

Async function to process each item

required
progress_callback Callable[[int, int, str], None] | None

Optional callback for progress updates (current, total, description)

None

Returns:

Type Description
list[Any]

List of processing results

Source code in src/appimage_updater/core/parallel.py
async def process_items_async(
    self,
    items: list[Any],
    async_worker_func: Callable[[Any], Coroutine[Any, Any, Any]],
    progress_callback: Callable[[int, int, str], None] | None = None,
) -> list[Any]:
    """Process items using concurrent async tasks for I/O-bound operations.

    Args:
        items: List of items to process
        async_worker_func: Async function to process each item
        progress_callback: Optional callback for progress updates (current, total, description)

    Returns:
        List of processing results
    """
    total_items = len(items)

    if total_items <= 1:
        return await self._process_sequentially(items, async_worker_func, progress_callback, total_items)

    return await self._process_concurrently(items, async_worker_func, progress_callback, total_items)