Skip to content
Snippets Groups Projects

Get rid of user activites table and replace it with redis

Merged James Lopez requested to merge fix/user-activities-performance into master
Files
3
+ 1
2
@@ -96,7 +96,6 @@ class User < ActiveRecord::Base
@@ -96,7 +96,6 @@ class User < ActiveRecord::Base
has_many :notification_settings, dependent: :destroy
has_many :notification_settings, dependent: :destroy
has_many :award_emoji, dependent: :destroy
has_many :award_emoji, dependent: :destroy
has_many :path_locks, dependent: :destroy
has_many :path_locks, dependent: :destroy
has_one :user_activity, dependent: :destroy
# Protected Branch Access
# Protected Branch Access
has_many :protected_branch_merge_access_levels, dependent: :destroy, class_name: ProtectedBranch::MergeAccessLevel
has_many :protected_branch_merge_access_levels, dependent: :destroy, class_name: ProtectedBranch::MergeAccessLevel
@@ -965,7 +964,7 @@ def increment_failed_attempts!
@@ -965,7 +964,7 @@ def increment_failed_attempts!
def record_activity
def record_activity
Gitlab::Redis.with do |redis|
Gitlab::Redis.with do |redis|
redis.zadd('gitlab:user:activities', Time.now.to_i, self.username)
redis.zadd('user/activities', Time.now.to_i, self.username)
end
end
end
end
Loading