Skip to content

A platform for community discussion. Free, open, simple.

PERF: Remove database query when publishing to staff users.

Guo Xiang Tan16f0d1c503ea
diff --git a/app/jobs/regular/backup_chunks_merger.rb b/app/jobs/regular/backup_chunks_merger.rb
index 5deb37f333b..aa359711ac6 100644
--- a/app/jobs/regular/backup_chunks_merger.rb
+++ b/app/jobs/regular/backup_chunks_merger.rb
@@ -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
diff --git a/app/jobs/regular/emit_web_hook_event.rb b/app/jobs/regular/emit_web_hook_event.rb
index 57ee27f2ce0..3c7fc3414c1 100644
--- a/app/jobs/regular/emit_web_hook_event.rb
+++ b/app/jobs/regular/emit_web_hook_event.rb
@@ -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)