• erio's avatar
    fix(billing): treat nil rate limit window as expired to prevent usage accumulation · 9e8959c5
    erio authored
    When Redis cache is populated from DB with a NULL window_1d_start, the
    Lua increment script only updates usage counters without setting window
    timestamps. IsWindowExpired(nil) previously returned false, so the
    accumulated usage was never reset across time windows, effectively
    turning usage_1d into a lifetime counter. Once this exceeded
    rate_limit_1d the key was incorrectly blocked with "日限额已用完".
    
    Fixes Wei-Shaw/sub2api#1022
    9e8959c5
api_key_rate_limit_test.go 5.83 KB