diff options
author | Sean McGivern <sean@gitlab.com> | 2017-10-04 13:43:39 +0100 |
---|---|---|
committer | Sean McGivern <sean@gitlab.com> | 2017-10-04 13:50:05 +0100 |
commit | d7717192782232c14c4f16962ab450b08348a4c9 (patch) | |
tree | e58691d259a9dc49065a9487f7036718339d902a /generator_templates/rails | |
parent | 4a4f809353a2e7007f8c6d33bfb1e4d09ed5a560 (diff) | |
download | gitlab-ce-d7717192782232c14c4f16962ab450b08348a4c9.tar.gz |
Speed up DeclarativePolicy::Runner#steps_by_score
There were a couple of things here:
1. If the state was already enabled, we don't need to check all the remaining
steps - only those that can prevent the state. (An enable followed by an
enable is a no-op.) This logic is in `#run`, but we still did the work of
scoring and sorting the steps.
2. The sorting is known to be inefficient, but we can make it slightly more
efficient by stopping once we have a step with zero score, as that means it's
free.
Neither of these make this _fast_, especially when called lots of times - as we
do when there is lots of activity on an issue - but they do help some.
Diffstat (limited to 'generator_templates/rails')
0 files changed, 0 insertions, 0 deletions