Don't raise when unsubscribing non-existent subscriptions

parent 5418f207
......@@ -22,6 +22,12 @@ end
private alias SubMan = PubRelay::SubscriptionManager
describe PubRelay::SubscriptionManager do
it "handles unsubscribing non-existant subscriptions" do
with_subscription_manager do |manager|
manager.send SubMan::Unsubscription.new("non-existant.com")
end
end
it "recycles gracefully" do
with_subscription_manager do |manager|
# Send a subscription to spawn a worker
......
......@@ -125,6 +125,8 @@ class PubRelay::SubscriptionManager
end
def call(unsubscribe : Unsubscription)
return unless @redis.exists(key_for(unsubscribe.domain)) == 1
deliver_worker = @workers.find { |worker| worker.domain == unsubscribe.domain }
raise "Worker not found for unsubscribe" unless deliver_worker
@subscribed_workers.delete(deliver_worker)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment