-
Notifications
You must be signed in to change notification settings - Fork 37
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Migrate more explicit thread usage to jobs #746
- Loading branch information
1 parent
d2c4502
commit 46a58bd
Showing
9 changed files
with
46 additions
and
39 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
class RecheckReviewQueueJob < ApplicationJob | ||
queue_as :default | ||
|
||
def perform(queue) | ||
queue.items.includes(:reviewable).each do |i| | ||
i.update(completed: true) if i.reviewable.should_dq?(queue) | ||
end | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
class RevalidateFlagConditionsJob < ApplicationJob | ||
queue_as :default | ||
|
||
def perform(*args) | ||
FlagCondition.where(flags_enabled: true).find_each do |fc| | ||
unless fc.validate | ||
failures = fc.errors.full_messages | ||
fc.flags_enabled = false | ||
fc.save(validate: false) | ||
ActionCable.server.broadcast 'smokedetector_messages', | ||
message: "@#{fc.user&.username&.tr(' ', '')} " \ | ||
"Your flag condition was disabled: #{failures.join(',')}" | ||
end | ||
end | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
class ValidateEligableFlaggersJob < ApplicationJob | ||
queue_as :default | ||
|
||
def perform(post) | ||
sys = User.find(-1) | ||
post.eligible_flaggers.each do |u| | ||
FlagCondition.validate_for_user(u, sys) | ||
end | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters