Commit Graph

21 Commits

Author SHA1 Message Date
Yorick Peterse 57b96eb6db
Fix refreshing of issues/MR count caches
This ensures the open issues/MR count caches are refreshed properly when
creating new issues or MRs. This MR also includes a change to the cache
keys to ensure all caches are rebuilt on the fly.

This particular problem was not caught in the test suite due to a null
cache being used, resulting in all calls that would use a cache using
the underlying data directly. In production the code would fail because
a newly saved record returns an empty hash in #changes meaning checks
such as `state_changed? || confidential_changed?` would return false for
new rows, thus never updating the counters.

Fixes https://gitlab.com/gitlab-org/gitlab-ce/issues/38061
2017-09-19 17:16:45 +02:00
Yorick Peterse 6ec53f5d48
Cache the number of open issues and merge requests
Every project page displays a navigation menu that in turn displays the
number of open issues and merge requests. This means that for every
project page we run two COUNT(*) queries, each taking up roughly 30
milliseconds on GitLab.com. By caching these numbers and refreshing them
whenever necessary we can reduce loading times of all these pages by up
to roughly 60 milliseconds.

The number of open issues does not include confidential issues. This is
a trade-off to keep the code simple and to ensure refreshing the data
only needs 2 COUNT(*) queries instead of 3. A downside is that if a
project only has 5 confidential issues the counter will be set to 0.

Because we now have 3 similar counting service classes the code
previously used in Projects::ForksCountService has mostly been moved to
Projects::CountService, which in turn is reused by the various service
classes.

Fixes https://gitlab.com/gitlab-org/gitlab-ce/issues/36622
2017-08-23 13:42:29 +02:00
Rémy Coutable ddccd24c13 Remove superfluous lib: true, type: redis, service: true, models: true, services: true, no_db: true, api: true
Signed-off-by: Rémy Coutable <remy@rymai.me>
2017-07-27 14:31:53 +02:00
Grzegorz Bizon 0430b76441 Enable Style/DotPosition Rubocop 👮 2017-06-21 13:48:12 +00:00
Valery Sizov 33687db01d Fix counters cache invalidation for Issues and Merge Requests 2017-05-26 17:43:51 +03:00
Valery Sizov ceb1ebd959 Active tense test coverage
Ports changes from https://gitlab.com/gitlab-org/gitlab-ee/merge_requests/642 back into CE
2017-02-01 22:45:41 +00:00
Douwe Maan 6df22f72c6 Rephrase some system notes to be compatible with new system note style 2016-11-24 18:26:29 +08:00
Rémy Coutable a54fdc384f Enforce permissions in `{Issues,MergeRequests}::{Close,Reopen}Service`
Signed-off-by: Rémy Coutable <remy@rymai.me>
2016-08-13 00:06:11 +02:00
tiagonbotelho 1d268a89de adds second batch of tests changed to active tense 2016-08-09 15:11:39 +01:00
Robert Speicher adc6ec4a9c Avoid `describe`-ing symbols in specs 2016-07-12 10:27:58 -05:00
Douglas Barbosa Alexandre 3d52e139b1 Rename Tasks to Todos 2016-02-20 12:39:27 -02:00
Douglas Barbosa Alexandre 139c513da6 Fix rubocop offenses 2016-02-20 12:12:05 -02:00
Douglas Barbosa Alexandre 3b98adcc75 Create a pending task when a user is mentioned when edit a issue/mr/note 2016-02-20 12:12:05 -02:00
Douglas Barbosa Alexandre c86b12bf69 Marks pending tasks for an user as done when he close the MR 2016-02-20 12:10:26 -02:00
Douwe Maan a2cfb44157 Tag service specs 2015-12-09 11:55:49 +01:00
Valery Sizov f1504e1ad5 test fix 2015-11-30 18:03:07 +02:00
Jeroen van Baarsen 0c4a70a306 Updated rspec to rspec 3.x syntax
Signed-off-by: Jeroen van Baarsen <jeroenvanbaarsen@gmail.com>
2015-02-12 19:17:35 +01:00
jubianchi 4ffdb83e71 Add action property to merge request hook 2015-01-20 10:50:24 +01:00
Jacob Vosmaer 780d868fec Revert "Merge branch 'fix-email-threading' into 'master'"
This reverts commit 97fd990ecd, reversing
changes made to f451a697e0.

Conflicts:
	app/mailers/emails/notes.rb
	app/mailers/emails/projects.rb
2014-06-18 13:41:12 +02:00
Pierre de La Morinerie 466b768bb3 Send notification emails to the "project", and put people in Cc
This fixes email threading in Mail.app, that doesn't like when a thread
doesn't have stable recipients.

For instance, here is a possible sender-recipient combinations before:

From: A
To: Me
New issue

From: B
To: Me
Reply on new issue

From: A
To: Me
Another reply

Mail.app doesn't see B as a participant to the original email thread,
and decides to break the thread: it will group all messages from A
together, and separately all messages from B.

This commit makes the thread look like this:

From: A
To: gitlab/project
Cc: Me
New issue

From: B
To: gitlab/project
Cc: Me
Reply on new issue

From: A
To: gitlab/project
Cc: Me
Another reply

Mail.app sees a common recipient, and group the thread correctly.
2014-06-10 17:09:15 +02:00
Dmitriy Zaporozhets 860f159d41
Add note when MR assignee changes. Add more tests to MR services
Signed-off-by: Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>
2014-04-03 18:16:05 +03:00