• Perform a simple search with rate limiting.

    Waits for manual pause to be lifted, optionally acquires a rate limit slot, then executes the search via the AniList client. Transient errors are handled by the rate limit queue's retry mechanism.

    Parameters

    • query: string

      Search query string.

    • page: number = 1

      Page number (1-based, default: 1).

    • perPage: number = 50

      Results per page (default: 50).

    • Optionaltoken: string

      Optional authentication token.

    • acquireLimit: boolean = true

      Whether to acquire rate limit slot (default: true).

    • bypassCache: boolean = false

      Whether to bypass cache (default: false).

    Returns Promise<SearchResult<AniListManga>>

    Promise resolving to search results.

    Propagates search errors after retries exhausted.

    export async function searchWithRateLimit(
    query: string,
    page: number = 1,
    perPage: number = 50,
    token?: string,
    acquireLimit: boolean = true,
    bypassCache: boolean = false,
    ): Promise<SearchResult<AniListManga>> {
    // Wait for any active manual pause to be lifted
    await waitWhileManuallyPaused();

    // Only wait for rate limit on the first request in a batch to avoid double-waiting
    if (acquireLimit) {
    await acquireRateLimit();
    }

    // Execute the search (client handles caching independently)
    return await searchManga(query, page, perPage, token, bypassCache);
    }