Commit graph

7 commits

Author SHA1 Message Date
Lin Jen-Shin
e8a455dc92 Following the feedbacks 2018-09-11 18:45:49 +08:00
Lin Jen-Shin
517ee9fd04 Fix Override. Properly define prepended
We should never be sloppy!
2018-09-11 18:45:49 +08:00
Lin Jen-Shin
f71fc9328c Also verify if extending would override a class method
Since extending a class means including on the singleton class of the
class, this should now complain this:

``` ruby
module M
  extend Gitlab::Utils::Override

  override :f
  def f
    super.succ
  end
end

class C
  extend M

  def self.f
    0
  end
end
```

It should complain because `C.f` wasn't calling `M#f`.
This should pass verification:

``` ruby
module M
  extend Gitlab::Utils::Override

  override :f
  def f
    super.succ
  end
end

class B
  def self.f
    0
  end
end

class C < B
  extend M
end
```

Because `C.f` would now call `M#f`, and `M#f` does override something.
2018-06-05 13:40:52 +08:00
Lin Jen-Shin
8139895b43 Use Gitlab::Utils::Override over defined?(super) 2017-12-26 17:18:10 +08:00
Zeger-Jan van de Weg
3ab026b7d6
Use memoization for commits on diffs
The Gitaly CommitService is being hammered by n + 1 calls, mostly when
finding commits. This leads to this gRPC being turned of on production:
https://gitlab.com/gitlab-org/gitaly/issues/514#note_48991378

Hunting down where it came from, most of them were due to
MergeRequest#show. To prove this, I set a script to request the
MergeRequest#show page 50 times. The GDK was being scraped by
Prometheus, where we have metrics on controller#action and their Gitaly
calls performed. On both occations I've restarted the full GDK so all
caches had to be rebuild.

Current master, 806a68a81f, needed 435 requests
After this commit, 154 requests
2017-12-12 16:28:26 +01:00
Lin Jen-Shin (godfat)
258bf3e187 Add Gitlab::Utils::StrongMemoize 2017-11-13 15:27:30 +00:00
Bob Van Landuyt
06e00913f5 Move merging of Hashes out of the GroupDescendant concern
Since it can technically merge any hash with objects that respond to `==`
2017-10-04 22:49:42 +02:00