Skip to content
Snippets Groups Projects

Cache the commit author in RequestStore to avoid extra lookups in PostReceive

Merged Stan Hu requested to merge stanhu/gitlab-ce:cache-commit-author-lookup into master
1 unresolved thread

In a PostReceive task with 697 commits (8.9 RC1 -> RC8), looking up the commit author takes about 10% of the time. Caching this information in RequestStore saves a few seconds from the overall processing time.

Improves #18663 (moved)

Merge request reports

Loading
Loading

Activity

Filter activity
  • Approvals
  • Assignees & reviewers
  • Comments (from bots)
  • Comments (from users)
  • Commits & branches
  • Edits
  • Labels
  • Lock status
  • Mentions
  • Merge request status
  • Tracking
178 178 end
179 179
180 180 def author
181 @author ||= User.find_by_any_email(author_email.downcase)
181 if RequestStore.active?
182 key = "commit_author:#{author_email.downcase}"
183 # nil is a valid value since no author may exist in the system
184 if RequestStore.store.has_key?(key)
185 @author = RequestStore.store[key]
186 else
187 @author = find_author_by_any_email
188 RequestStore.store[key] = @author
189 end
  • yorickpeterse-staging Status changed to merged

    Status changed to merged

  • mentioned in commit 9b0e131b

  • Please register or sign in to reply
    Loading