PERF: Remove database query when publishing to staff users.

This commit is contained in:
Guo Xiang Tan 2020-04-27 11:50:21 +08:00
parent e0aec23844
commit 16f0d1c503
No known key found for this signature in database
GPG Key ID: FBD110179AAC1F20
2 changed files with 2 additions and 2 deletions

View File

@ -32,7 +32,7 @@ module Jobs
# push an updated list to the clients
store = BackupRestore::BackupStore.create
data = ActiveModel::ArraySerializer.new(store.files, each_serializer: BackupFileSerializer).as_json
MessageBus.publish("/admin/backups", data, user_ids: User.staff.pluck(:id))
MessageBus.publish("/admin/backups", data, group_ids: [Group::AUTO_GROUPS[:staff]])
end
end

View File

@ -103,7 +103,7 @@ module Jobs
MessageBus.publish("/web_hook_events/#{@web_hook.id}", {
web_hook_event_id: web_hook_event.id,
event_type: @arguments[:event_type]
}, user_ids: User.human_users.staff.pluck(:id))
}, group_ids: [Group::AUTO_GROUPS[:staff]])
end
def ping_event?(event_type)