Skip to content
  • Niklas Hambuechen's avatar
    ReasonRateLimiting: Fix scheduling rate-limited jobs · 234a9b71
    Niklas Hambuechen authored
    The semantics change in the SlotMap simplification (commit 7a3aa19f)
    purposely made `hasSlotsFor`/`occupySlots` reject keys that were not
    in the SlotMap, for example
    
        [] `hasSlotsFor` [("key", 1)] == False
    
    Unfortunately, I forgot to adjust the `initSlotMap` in `reasonRateLimit`:
    While before it was allowed to start empty (`occupySlots` would create
    the slots on the fly), commit 7a3aa19f
    
     should have changed it to start
    with all keys present and set to all buckets unoccupied.
    
    This led to all jobs with a `rate-limit:n:...` reason to be
    rate-limited unconditionally (they were never run).
    
    This commit fixes it by adjusting `initSlotMap` as described above.
    
    Signed-off-by: default avatarNiklas Hambuechen <niklash@google.com>
    Reviewed-by: default avatarKlaus Aehlig <aehlig@google.com>
    234a9b71