Fixes #3940 - dead lock on user update in high load environment.
This commit is contained in:
parent
b40ca87b2a
commit
bd373de069
3 changed files with 12 additions and 2 deletions
|
@ -14,8 +14,7 @@ module HasGroupRelationDefinition
|
|||
validates :access, presence: true
|
||||
validate :validate_access
|
||||
|
||||
after_save :touch_related
|
||||
after_destroy :touch_related
|
||||
after_commit :touch_related
|
||||
end
|
||||
|
||||
private
|
||||
|
|
|
@ -178,6 +178,7 @@ class CreateBase < ActiveRecord::Migration[4.2]
|
|||
add_index :groups_users, [:user_id]
|
||||
add_index :groups_users, [:group_id]
|
||||
add_index :groups_users, [:access]
|
||||
add_index :groups_users, %i[user_id group_id access]
|
||||
add_foreign_key :groups_users, :users
|
||||
add_foreign_key :groups_users, :groups
|
||||
|
||||
|
|
10
db/migrate/20220131135531_issue3940_add_index.rb
Normal file
10
db/migrate/20220131135531_issue3940_add_index.rb
Normal file
|
@ -0,0 +1,10 @@
|
|||
# Copyright (C) 2012-2022 Zammad Foundation, https://zammad-foundation.org/
|
||||
|
||||
class Issue3940AddIndex < ActiveRecord::Migration[6.0]
|
||||
def change
|
||||
# return if it's a new setup
|
||||
return if !Setting.exists?(name: 'system_init_done')
|
||||
|
||||
add_index :groups_users, %i[user_id group_id access]
|
||||
end
|
||||
end
|
Loading…
Reference in a new issue