Compare commits

..

2 Commits

Author SHA1 Message Date
sophie [⛧-440729]
5b90109782
Merge 3850739d7f into 4782a67038 2024-08-27 08:48:40 +00:00
⛧-440729 [sophie]
3850739d7f
apply review suggestions 2024-08-27 10:48:34 +02:00

View File

@ -47,9 +47,9 @@ class Invidious::Jobs::NotificationJob < Invidious::Jobs::BaseJob
begin
loop do
notification = notification_channel.receive
notify_mutex.lock
to_notify[notification.channel_id] << notification
notify_mutex.unlock
notify_mutex.synchronize do
to_notify[notification.channel_id] << notification
end
end
end
end
@ -58,10 +58,11 @@ class Invidious::Jobs::NotificationJob < Invidious::Jobs::BaseJob
loop do
begin
LOGGER.debug("NotificationJob: waking up")
notify_mutex.lock
cloned = to_notify.clone
to_notify.clear
notify_mutex.unlock
cloned = {} of String => Set(VideoNotification)
notify_mutex.synchronize do
cloned = to_notify.clone
to_notify.clear
end
cloned.each do |channel_id, notifications|
if notifications.empty?