<feed xmlns='http://www.w3.org/2005/Atom'>
<title>delta/gitlab/gitlab-ce.git/app/models/service.rb, branch 14176-diff-paste-data</title>
<subtitle>gitlab.com: gitlab-org/gitlab-ce.git
</subtitle>
<link rel='alternate' type='text/html' href='http://git.baserock.org/cgit/delta/gitlab/gitlab-ce.git/'/>
<entry>
<title>Greatly improve external_issue_tracker performance</title>
<updated>2016-01-19T13:03:20+00:00</updated>
<author>
<name>Yorick Peterse</name>
<email>yorickpeterse@gmail.com</email>
</author>
<published>2016-01-19T12:48:07+00:00</published>
<link rel='alternate' type='text/html' href='http://git.baserock.org/cgit/delta/gitlab/gitlab-ce.git/commit/?id=b4ee6f57b9322401d1439eb21f9160ae2cb91d14'/>
<id>b4ee6f57b9322401d1439eb21f9160ae2cb91d14</id>
<content type='text'>
This greatly improves the performance of Project#external_issue_tracker
by moving most of the fields queried in Ruby to the database and letting
the database handle all logic. Prior to this change the process of
finding an external issue tracker was along the lines of the following:

1. Load all project services into memory.
2. Reduce the list to only services where "issue_tracker?" returns true
3. Reduce the list from step 2 to service where "default?" returns false
4. Find the first service where "activated?" returns true

This has to two big problems:

1. Loading all services into memory only to reduce the list down to a
   single item later on is a waste of memory (and slow timing wise).
2. Calling Array#select followed by Array#reject followed by Array#find
   allocates extra objects when this really isn't needed.

To work around this the following service fields have been moved to the
database (instead of being hardcoded):

* category
* default

This in turn means we can get the external issue tracker using the
following query:

    SELECT *
    FROM services
    WHERE active IS TRUE
    AND default IS FALSE
    AND category = 'issue_tracker'
    AND project_id = XXX
    LIMIT 1

This coupled with memoizing the result (just as before this commit)
greatly reduces the time it takes for Project#external_issue_tracker to
complete. The exact reduction depends on one's environment, but locally
the execution time is reduced from roughly 230 ms to only 2 ms (= a
reduction of almost 180x).

Fixes gitlab-org/gitlab-ce#10771
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
This greatly improves the performance of Project#external_issue_tracker
by moving most of the fields queried in Ruby to the database and letting
the database handle all logic. Prior to this change the process of
finding an external issue tracker was along the lines of the following:

1. Load all project services into memory.
2. Reduce the list to only services where "issue_tracker?" returns true
3. Reduce the list from step 2 to service where "default?" returns false
4. Find the first service where "activated?" returns true

This has to two big problems:

1. Loading all services into memory only to reduce the list down to a
   single item later on is a waste of memory (and slow timing wise).
2. Calling Array#select followed by Array#reject followed by Array#find
   allocates extra objects when this really isn't needed.

To work around this the following service fields have been moved to the
database (instead of being hardcoded):

* category
* default

This in turn means we can get the external issue tracker using the
following query:

    SELECT *
    FROM services
    WHERE active IS TRUE
    AND default IS FALSE
    AND category = 'issue_tracker'
    AND project_id = XXX
    LIMIT 1

This coupled with memoizing the result (just as before this commit)
greatly reduces the time it takes for Project#external_issue_tracker to
complete. The exact reduction depends on one's environment, but locally
the execution time is reduced from roughly 230 ms to only 2 ms (= a
reduction of almost 180x).

Fixes gitlab-org/gitlab-ce#10771
</pre>
</div>
</content>
</entry>
<entry>
<title>Annotate models</title>
<updated>2016-01-06T13:09:55+00:00</updated>
<author>
<name>Stan Hu</name>
<email>stanhu@gmail.com</email>
</author>
<published>2016-01-06T02:30:59+00:00</published>
<link rel='alternate' type='text/html' href='http://git.baserock.org/cgit/delta/gitlab/gitlab-ce.git/commit/?id=79c0e7212af0a6b0243bc0512a75eb936fb8d862'/>
<id>79c0e7212af0a6b0243bc0512a75eb936fb8d862</id>
<content type='text'>
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
</pre>
</div>
</content>
</entry>
<entry>
<title>Migrate CI::Project to Project</title>
<updated>2015-12-11T17:02:09+00:00</updated>
<author>
<name>Kamil Trzcinski</name>
<email>ayufan@ayufan.eu</email>
</author>
<published>2015-12-04T11:55:23+00:00</published>
<link rel='alternate' type='text/html' href='http://git.baserock.org/cgit/delta/gitlab/gitlab-ce.git/commit/?id=e80e3f5372d6bcad1fbe04a85b3086bb66794828'/>
<id>e80e3f5372d6bcad1fbe04a85b3086bb66794828</id>
<content type='text'>
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
</pre>
</div>
</content>
</entry>
<entry>
<title>Fix indentation and BuildsEmailService</title>
<updated>2015-12-11T17:01:57+00:00</updated>
<author>
<name>Kamil Trzcinski</name>
<email>ayufan@ayufan.eu</email>
</author>
<published>2015-12-11T17:01:57+00:00</published>
<link rel='alternate' type='text/html' href='http://git.baserock.org/cgit/delta/gitlab/gitlab-ce.git/commit/?id=8b4cdc50fca816b4f56f8579e17c4dba836ec797'/>
<id>8b4cdc50fca816b4f56f8579e17c4dba836ec797</id>
<content type='text'>
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
</pre>
</div>
</content>
</entry>
<entry>
<title>Change default values</title>
<updated>2015-12-11T12:28:40+00:00</updated>
<author>
<name>Kamil Trzcinski</name>
<email>ayufan@ayufan.eu</email>
</author>
<published>2015-12-11T12:28:40+00:00</published>
<link rel='alternate' type='text/html' href='http://git.baserock.org/cgit/delta/gitlab/gitlab-ce.git/commit/?id=71e6a93db979165073161f0dc13d3bfe7a461e4a'/>
<id>71e6a93db979165073161f0dc13d3bfe7a461e4a</id>
<content type='text'>
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
</pre>
</div>
</content>
</entry>
<entry>
<title>Fix specs</title>
<updated>2015-12-10T15:16:34+00:00</updated>
<author>
<name>Kamil Trzcinski</name>
<email>ayufan@ayufan.eu</email>
</author>
<published>2015-12-10T15:16:34+00:00</published>
<link rel='alternate' type='text/html' href='http://git.baserock.org/cgit/delta/gitlab/gitlab-ce.git/commit/?id=c4fa894de22a6ba20f3078f490b708c81b6d6464'/>
<id>c4fa894de22a6ba20f3078f490b708c81b6d6464</id>
<content type='text'>
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
</pre>
</div>
</content>
</entry>
<entry>
<title>Migrate CI::Services and CI::WebHooks to Services and WebHooks</title>
<updated>2015-12-10T15:04:08+00:00</updated>
<author>
<name>Kamil Trzcinski</name>
<email>ayufan@ayufan.eu</email>
</author>
<published>2015-12-07T12:23:23+00:00</published>
<link rel='alternate' type='text/html' href='http://git.baserock.org/cgit/delta/gitlab/gitlab-ce.git/commit/?id=2988e1fbf50b3c9e803a9358933e3e969e64dcc3'/>
<id>2988e1fbf50b3c9e803a9358933e3e969e64dcc3</id>
<content type='text'>
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
</pre>
</div>
</content>
</entry>
<entry>
<title>Improve invalidation of stored service password if the endpoint URL is changed</title>
<updated>2015-10-15T10:07:59+00:00</updated>
<author>
<name>Alex Lossent</name>
<email>alexandre.lossent@cern.ch</email>
</author>
<published>2015-10-15T07:09:01+00:00</published>
<link rel='alternate' type='text/html' href='http://git.baserock.org/cgit/delta/gitlab/gitlab-ce.git/commit/?id=98e666ab6a61ef67c2ba15d31839fd1cf414d587'/>
<id>98e666ab6a61ef67c2ba15d31839fd1cf414d587</id>
<content type='text'>
Password can now be specified at the same time as the new URL, and the service
template admin pages now work.
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Password can now be specified at the same time as the new URL, and the service
template admin pages now work.
</pre>
</div>
</content>
</entry>
<entry>
<title>Revert "Improve invalidation of stored service password if the endpoint URL is changed"</title>
<updated>2015-10-14T16:21:27+00:00</updated>
<author>
<name>Valery Sizov</name>
<email>vsv2711@gmail.com</email>
</author>
<published>2015-10-14T16:21:27+00:00</published>
<link rel='alternate' type='text/html' href='http://git.baserock.org/cgit/delta/gitlab/gitlab-ce.git/commit/?id=b83a18a55cd03cfa6d0d631b8d4567ae29b5fe26'/>
<id>b83a18a55cd03cfa6d0d631b8d4567ae29b5fe26</id>
<content type='text'>
This reverts commit b46397548056e4e8ef00efe4f641c61ba1dd5230.
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
This reverts commit b46397548056e4e8ef00efe4f641c61ba1dd5230.
</pre>
</div>
</content>
</entry>
<entry>
<title>Improve invalidation of stored service password if the endpoint URL is changed</title>
<updated>2015-10-14T13:27:59+00:00</updated>
<author>
<name>Alex Lossent</name>
<email>alexandre.lossent@cern.ch</email>
</author>
<published>2015-10-13T09:29:57+00:00</published>
<link rel='alternate' type='text/html' href='http://git.baserock.org/cgit/delta/gitlab/gitlab-ce.git/commit/?id=b46397548056e4e8ef00efe4f641c61ba1dd5230'/>
<id>b46397548056e4e8ef00efe4f641c61ba1dd5230</id>
<content type='text'>
It now allows to specify a password at the same time as the new URL, and works
on the service template admin pages.
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
It now allows to specify a password at the same time as the new URL, and works
on the service template admin pages.
</pre>
</div>
</content>
</entry>
</feed>
