Skip to content
Snippets Groups Projects

Add RequestCache to cache via RequestStore

Merged username-removed-423915 requested to merge request-store-wrap into master
  1. Jul 18, 2017
  2. Jul 17, 2017
    • Lin Jen-Shin's avatar
      042cf15b
    • Lin Jen-Shin's avatar
      Add changelog entry · 4d03873c
      Lin Jen-Shin authored
      4d03873c
    • Lin Jen-Shin's avatar
      76c9f071
    • Lin Jen-Shin's avatar
      Use RequestStoreWrap for Commit#author · aada5273
      Lin Jen-Shin authored
      We also try to use instance variable to cache the result if
      RequestStore is not available, so we could keep the same logic,
      using the same cache key. Also introduce a way to specify method
      specific cache key
      aada5273
    • Lin Jen-Shin's avatar
      Add RequestStoreWrap to cache via RequestStore · 143fc48a
      Lin Jen-Shin authored
      I don't like the idea of `RequestStore` at all, because it's just a
      global state which shouldn't be used at all. But we have a number of
      places calling `ProtectedBranch.protected?` and `ProtectedTag.protected?`
      in a loop for the same user, project, and ref whenever we're checking
      against if the jobs for a given pipeline is accessible for a given user.
      This means we're effectively making N queries for the same thing over
      and over.
      
      To properly fix this, we need to change how we check the permission,
      and that could be a huge work. To solve this quickly, adding a cache
      layer for the given request would be quite simple to do.
      
      We're already doing this in Commit#author, and this is extending that
      idea and make it generalized.
      143fc48a
Loading