Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
What's new
10
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Open sidebar
gab
social
gab-social
Commits
4696307c
Commit
4696307c
authored
Feb 18, 2021
by
Fosco Marotto
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Use a writing role for some sidekiq worker reads
parent
de7d71e0
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
8 additions
and
4 deletions
+8
-4
app/workers/bootstrap_timeline_worker.rb
app/workers/bootstrap_timeline_worker.rb
+3
-1
app/workers/local_notification_worker.rb
app/workers/local_notification_worker.rb
+5
-3
No files found.
app/workers/bootstrap_timeline_worker.rb
View file @
4696307c
...
...
@@ -4,6 +4,8 @@ class BootstrapTimelineWorker
include
Sidekiq
::
Worker
def
perform
(
account_id
)
BootstrapTimelineService
.
new
.
call
(
Account
.
find
(
account_id
))
ActiveRecord
::
Base
.
connected_to
(
role: :writing
)
do
BootstrapTimelineService
.
new
.
call
(
Account
.
find
(
account_id
))
end
end
end
app/workers/local_notification_worker.rb
View file @
4696307c
...
...
@@ -8,10 +8,12 @@ class LocalNotificationWorker
def
perform
(
receiver_account_id
,
activity_id
=
nil
,
activity_class_name
=
nil
)
return
true
if
activity_id
.
nil?
or
activity_class_name
.
nil?
receiver
=
Account
.
find
(
receiver_account_id
)
activity
=
activity_class_name
.
constantize
.
find
(
activity_id
)
ActiveRecord
::
Base
.
connected_to
(
role: :writing
)
do
receiver
=
Account
.
find
(
receiver_account_id
)
activity
=
activity_class_name
.
constantize
.
find
(
activity_id
)
NotifyService
.
new
.
call
(
receiver
,
activity
)
NotifyService
.
new
.
call
(
receiver
,
activity
)
end
rescue
ActiveRecord
::
RecordNotFound
true
end
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment