Commit Graph

8 Commits

Author SHA1 Message Date
Yorick Peterse 92b2c74ce1
Refresh project authorizations using a Redis lease
When I proposed using serializable transactions I was hoping we would be
able to refresh data of individual users concurrently. Unfortunately
upon closer inspection it was revealed this was not the case. This could
result in a lot of queries failing due to serialization errors,
overloading the database in the process (given enough workers trying to
update the target table).

To work around this we're now using a Redis lease that is cancelled upon
completion. This ensures we can update the data of different users
concurrently without overloading the database.

The code will try to obtain the lease until it succeeds, waiting at
least 1 second between retries. This is necessary as we may otherwise
end up _not_ updating the data which is not an option.
2016-11-25 13:35:01 +01:00
Ahmad Sherif 2ea5ef0ba4 Update ProjectTeam#fetch_members to use project authorizations 2016-11-23 12:59:13 +02:00
Rémy Coutable ec0061a95c Allow Member.add_user to handle access requesters
Changes include:

- Ensure Member.add_user is not called directly when not necessary
- New GroupMember.add_users_to_group to have the same abstraction level as for Project
- Refactor Member.add_user to take a source instead of an array of members
- Fix Rubocop offenses
- Always use Project#add_user instead of project.team.add_user
- Factorize users addition as members in Member.add_users_to_source
- Make access_level a keyword argument in GroupMember.add_users_to_group and ProjectMember.add_users_to_projects
- Destroy any requester before adding them as a member
- Improve the way we handle access requesters in Member.add_user
  Instead of removing the requester and creating a new member,
  we now simply accepts their access request. This way, they will
  receive a "access request granted" email.
- Fix error that was previously silently ignored
- Stop raising when access level is invalid in Member, let Rails validation do their work

Signed-off-by: Rémy Coutable <remy@rymai.me>
2016-09-28 09:43:00 +02:00
Dmitriy Zaporozhets e4bc359841
Fix dev fixtures
Signed-off-by: Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>
2014-09-18 20:19:11 +03:00
Dmitriy Zaporozhets 39f80884db
Improve developer seeds
Return execution of observers in seeds.
Mute email sending to letter opening in you browser.
Added `rake dev` task to reset db and add seeds.

Signed-off-by: Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>
2014-03-15 11:39:35 +02:00
Dmitriy Zaporozhets f47ba909a2 Fix seeds. More projects for dev seeds 2013-06-20 13:14:23 +03:00
Dmitriy Zaporozhets b65903e005 Improve development fixtures 2013-04-05 15:42:07 +03:00
Dmitriy Zaporozhets 38985390b0 Refactored and fixed seeds to work with gitlab-shell 2013-02-09 15:13:56 +02:00