summaryrefslogtreecommitdiff
path: root/lib
Commit message (Collapse)AuthorAgeFilesLines
* Fix race conditions for AuthorizedProjectsWorkerrefresh-authorizations-fork-joinYorick Peterse2017-01-254-0/+116
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | There were two cases that could be problematic: 1. Because sometimes AuthorizedProjectsWorker would be scheduled in a transaction it was possible for a job to run/complete before a COMMIT; resulting in it either producing an error, or producing no new data. 2. When scheduling jobs the code would not wait until completion. This could lead to a user creating a project and then immediately trying to push to it. Usually this will work fine, but given enough load it might take a few seconds before a user has access. The first one is problematic, the second one is mostly just annoying (but annoying enough to warrant a solution). This commit changes two things to deal with this: 1. Sidekiq scheduling now takes places after a COMMIT, this is ensured by scheduling using Rails' after_commit hook instead of doing so in an arbitrary method. 2. When scheduling jobs the calling thread now waits for all jobs to complete. Solution 2 requires tracking of job completions. Sidekiq provides a way to find a job by its ID, but this involves scanning over the entire queue; something that is very in-efficient for large queues. As such a more efficient solution is necessary. There are two main Gems that can do this in a more efficient manner: * sidekiq-status * sidekiq_status No, this is not a joke. Both Gems do a similar thing (but slightly different), and the only difference in their name is a dash vs an underscore. Both Gems however provide far more than just checking if a job has been completed, and both have their problems. sidekiq-status does not appear to be actively maintained, with the last release being in 2015. It also has some issues during testing as API calls are not stubbed in any way. sidekiq_status on the other hand does not appear to be very popular, and introduces a similar amount of code. Because of this I opted to write a simple home grown solution. After all, all we need is storing a job ID somewhere so we can efficiently look it up; we don't need extra web UIs (as provided by sidekiq-status) or complex APIs to update progress, etc. This is where Gitlab::SidekiqStatus comes in handy. This namespace contains some code used for tracking, removing, and looking up job IDs; all without having to scan over an entire queue. Data is removed explicitly, but also expires automatically just in case. Using this API we can now schedule jobs in a fork-join like manner: we schedule the jobs in Sidekiq, process them in parallel, then wait for completion. By using Sidekiq we can leverage all the benefits such as being able to scale across multiple cores and hosts, retrying failed jobs, etc. The one downside is that we need to make sure we can deal with unexpected increases in job processing timings. To deal with this the class Gitlab::JobWaiter (used for waiting for jobs to complete) will only wait a number of seconds (30 by default). Once this timeout is reached it will simply return. For GitLab.com almost all AuthorizedProjectWorker jobs complete in seconds, only very rarely do we spike to job timings of around a minute. These in turn seem to be the result of external factors (e.g. deploys), in which case a user is most likely not able to use the system anyway. In short, this new solution should ensure that jobs are processed properly and that in almost all cases a user has access to their resources whenever they need to have access.
* Revert "Merge branch 'dont-persist-application-settings-in-test-env' into ↵Grzegorz Bizon2017-01-212-16/+32
| | | | | 'master'" This reverts merge request !8573
* Revert "Merge branch 'backport-fix-load-error' into 'master'"Stan Hu2017-01-211-3/+3
| | | This reverts merge request !8671
* Don't define ApplicationSetting defaults in a constantbackport-fix-load-errorRémy Coutable2017-01-201-3/+3
| | | | Signed-off-by: Rémy Coutable <remy@rymai.me>
* Merge branch 'fix/import-users' into 'master' Rémy Coutable2017-01-202-14/+6
|\ | | | | | | | | | | | | Fix import no longer mapping users as admin Closes #25346 See merge request !8625
| * fix member mapper specfix/import-usersJames Lopez2017-01-201-2/+0
| |
| * fix typoJames Lopez2017-01-191-1/+1
| |
| * fix and refactor note user mappingJames Lopez2017-01-182-9/+3
| |
| * added spec replicating the problemJames Lopez2017-01-181-1/+1
| |
| * do not map usersat all unless adminJames Lopez2017-01-181-2/+2
| |
* | Merge branch 'dont-persist-application-settings-in-test-env' into 'master' Robert Speicher2017-01-202-32/+16
|\ \ | | | | | | | | | | | | Don't persist application settings in test env See merge request !8573
| * | Don't persist ApplicationSetting in test envdont-persist-application-settings-in-test-envRémy Coutable2017-01-152-4/+16
| | | | | | | | | | | | Signed-off-by: Rémy Coutable <remy@rymai.me>
| * | Move default values to ApplicationSetting::DEFAULTS and use it in ↵Rémy Coutable2017-01-151-29/+1
| | | | | | | | | | | | | | | | | | CurrentSettings Signed-off-by: Rémy Coutable <remy@rymai.me>
* | | Fix specsKamil Trzcinski2017-01-191-1/+1
| | |
* | | Merge remote-tracking branch 'origin/master' into 21698-redis-runner-last-buildKamil Trzcinski2017-01-198-1/+133
|\ \ \
| * \ \ Merge branch 'feature/gitaly-feature-flag' into 'master' Robert Speicher2017-01-191-1/+8
| |\ \ \ | | | | | | | | | | | | | | | | | | | | Gitaly feature flag See merge request !8440
| | * | | Pass Gitaly resource path to gitlab-workhorse if Gitaly is enabledfeature/gitaly-feature-flagAhmad Sherif2017-01-181-1/+8
| | | | |
| * | | | Merge branch '23563-document-presenters' into 'master' Dmitriy Zaporozhets2017-01-194-0/+88
| |\ \ \ \ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Document presenters Closes #23563 See merge request !8480
| | * | | | More improvements to presenters23563-document-presentersRémy Coutable2017-01-182-6/+10
| | | | | | | | | | | | | | | | | | | | | | | | Signed-off-by: Rémy Coutable <remy@rymai.me>
| | * | | | Improve presenter factoryRémy Coutable2017-01-182-39/+22
| | | | | | | | | | | | | | | | | | | | | | | | Signed-off-by: Rémy Coutable <remy@rymai.me>
| | * | | | Improve presenter architectureRémy Coutable2017-01-184-32/+62
| | | | | | | | | | | | | | | | | | | | | | | | Signed-off-by: Rémy Coutable <remy@rymai.me>
| | * | | | Document presentersRémy Coutable2017-01-182-0/+71
| | | |_|/ | | |/| | | | | | | | | | | | Signed-off-by: Rémy Coutable <remy@rymai.me>
| * | | | Merge branch 'fix/external-status-badge-links' into 'master' Kamil Trzciński2017-01-193-0/+37
| |\ \ \ \ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Link external commit status badges to target URLs Closes #25662 See merge request !8611
| | * | | | Respond with validation errors in commit status APIfix/external-status-badge-linksGrzegorz Bizon2017-01-181-0/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | If validation errors are present, include validation errors in the commit status API payload, instead of depending on state machine errors caused by invalid record.
| | * | | | Link external commit status badge to a target URLGrzegorz Bizon2017-01-171-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | Using new detailed statuses factory for external commit statuses.
| | * | | | Add detailed statuses for external commit statusesGrzegorz Bizon2017-01-172-0/+35
| | | | | |
* | | | | | Fix specsKamil Trzcinski2017-01-191-1/+1
| | | | | |
* | | | | | Merge remote-tracking branch 'origin/master' into 21698-redis-runner-last-buildKamil Trzcinski2017-01-19187-1122/+6359
|\ \ \ \ \ \ | |/ / / / /
| * | | | | Merge branch 'fix/refactor-cycle-analytics-stages' into 'master' Douwe Maan2017-01-1831-210/+439
| |\ \ \ \ \ | | | | | | | | | | | | | | | | | | | | | | | | | | | | Refactor cycle analytics stages (1st iteration) See merge request !7647
| | * | | | | fix specfix/refactor-cycle-analytics-stagesJames Lopez2017-01-171-2/+2
| | | | | | |
| | * | | | | refactored a bunch of stuff based on feedbackJames Lopez2017-01-1710-43/+49
| | | | | | |
| | * | | | | fix bug retrieving mediansJames Lopez2017-01-171-1/+1
| | | | | | |
| | * | | | | fix specsJames Lopez2017-01-172-5/+5
| | | | | | |
| | * | | | | refactored metrics fetcher - merged into stage and eventsJames Lopez2017-01-1715-119/+116
| | | | | | |
| | * | | | | fix refactor of production event fetcherJames Lopez2017-01-172-17/+17
| | | | | | |
| | * | | | | a few more fixesJames Lopez2017-01-172-18/+1
| | | | | | |
| | * | | | | fix missing refactor in metrics fetcherJames Lopez2017-01-171-2/+2
| | | | | | |
| | * | | | | fix plan stage issue and some spec failuresJames Lopez2017-01-173-3/+9
| | | | | | |
| | * | | | | fix specs, refactor missing bits from events stuffJames Lopez2017-01-174-11/+12
| | | | | | |
| | * | | | | big refactor based on MR feedbackJames Lopez2017-01-1721-117/+123
| | | | | | |
| | * | | | | few fixes after mergeJames Lopez2017-01-172-3/+10
| | | | | | |
| | * | | | | refactor fetcher and fixed specsJames Lopez2017-01-174-34/+22
| | | | | | |
| | * | | | | refactor cycle analytics - updated based on MR feedbackJames Lopez2017-01-1713-61/+89
| | | | | | |
| | * | | | | Fix other spec failuresJames Lopez2017-01-175-44/+5
| | | | | | |
| | * | | | | more refactoring and fixing old specsJames Lopez2017-01-171-15/+3
| | | | | | |
| | * | | | | added new summary serializers and refactor all of the summary stuff into ↵James Lopez2017-01-175-0/+118
| | | | | | | | | | | | | | | | | | | | | | | | | | | | separate logical classes
| | * | | | | fixed stage entity and added missing stage specsJames Lopez2017-01-171-1/+5
| | | | | | |
| | * | | | | added analytics stage serializer and moved some info to the stage classes ↵James Lopez2017-01-178-0/+44
| | | | | | | | | | | | | | | | | | | | | | | | | | | | from the controller
| | * | | | | WIP - started refactoring cycle analytics median stuff into stagesJames Lopez2017-01-1718-19/+111
| | |/ / / /
| * | | | | Merge branch 'time-tracking-api' into 'master' Sean McGivern2017-01-186-11/+144
| |\ \ \ \ \ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Time tracking API Closes #25861 See merge request !8483