• Gets when a track was last logged

    Retrieves the timestamp when a specific track was last logged or processed. Returns 0 if the track has never been logged.

    Parameters

    • trackId: string

      Spotify track ID to check

    Returns number

    Millisecond timestamp when the track was last logged, or 0 if never logged

    // Check if we've recently logged a track
    const lastLogged = getTrackLastLogged('spotify:track:1234567890');
    const fiveMinutesAgo = Date.now() - (5 * 60 * 1000);

    if (lastLogged > fiveMinutesAgo) {
    console.log('Track was logged less than 5 minutes ago');
    }
    export function getTrackLastLogged(trackId: string): number {
    return trackLastLogged[trackId] || 0;
    }