• Stan Hu's avatar
    Remove unnecessary Redis deletes for broadcast messages · 94305e86
    Stan Hu authored
    https://gitlab.com/gitlab-org/gitlab/-/merge_requests/21038 removed an
    optimization that prevented a Redis DEL call from being issued if no
    broadcast messages were present. Now, two DEL calls are issued for every
    request, which led to a significant performance regression.
    
    The Redis delete optimization was intended to prevent filtering stale
    messages over and over again. However, the optimization only worked when
    there were no other broadcast messages for the future. For example, if
    there were 1 current message and 1 message scheduled for 5 days later,
    the filtering would still need to be done.
    
    To improve this optimization, we check to see whether the filtered set
    is different from the set we retrieved from the cache. If there is a
    difference, we know it's time to flush the cache.
    
    This came out of an investigation in
    https://gitlab.com/gitlab-com/gl-infra/production/issues/1722.
    94305e86
broadcast_message.rb 2.85 KB