• Manually triggers a metrics aggregation

    Forces an immediate execution of the complete aggregation process outside of the scheduled interval. Useful for:

    • Immediate updates after significant listening activity
    • Testing or debugging the aggregation process
    • User-requested refresh of statistics

    The function runs the same comprehensive aggregation process as the scheduled background task but executes immediately and provides detailed error information if aggregation fails.

    Returns Promise<void>

    Promise that resolves when aggregation completes

    Error if aggregation process fails

    // Trigger manual update with error handling
    try {
    await triggerManualAggregation();
    showSuccessMessage();
    } catch (error) {
    showErrorMessage(error);
    }
    export async function triggerManualAggregation(): Promise<void> {
    try {
    saveLog("Manually triggering skip metrics aggregation", "INFO");
    await runAggregation();
    saveLog("Manual aggregation completed successfully", "INFO");
    } catch (error) {
    saveLog(`Error during manual skip metrics aggregation: ${error}`, "ERROR");
    throw error;
    }
    }