1. 09 Aug, 2019 1 commit
    • Patrick Bajao's avatar
      Invalidate branches cache on PostReceive · d96c24d8
      Patrick Bajao authored
      Whenever `PostReceive` is enqueued, `UpdateMergeRequestsWorker`
      is enqueued and `MergeRequests::RefreshService` is called, it'll
      check if the source branch of each MR asssociated to the push exists
      or not via `MergeRequest#source_branch_exists?`. The said method will
      call `Repository#branch_exists?` which is cached in `Rails.cache`.
      
      When the cache contains outdated data and the source branch actually
      exists, the `MergeRequests#RefreshService` job will close associated
      MRs which is not correct.
      
      The fix is to expire the branches cache of the project so we have
      updated data during the post receive hook which will help in the
      accuracy of the check if we need to close associated MRs or not.
      d96c24d8
  2. 08 Aug, 2019 39 commits