Replace SubscriptionManager#deliver with a Deliver message

parent a26a6b58
......@@ -11,7 +11,11 @@ class PubRelay::SubscriptionManager
record Unsubscription,
domain : String
include Earl::Artist(Subscription | AcceptSent | Unsubscription)
record Deliver,
message : String,
source_domain : String
include Earl::Artist(Subscription | AcceptSent | Unsubscription | Deliver)
enum State
Pending
......@@ -139,9 +143,9 @@ class PubRelay::SubscriptionManager
@redis.del(key_for(unsubscribe.domain))
end
def deliver(message : String, source_domain : String)
def call(deliver : Deliver)
counter = new_counter
delivery = DeliverWorker::Delivery.new(message, source_domain, counter, accept: false)
delivery = DeliverWorker::Delivery.new(deliver.message, deliver.source_domain, counter, accept: false)
select_actions = @subscribed_workers.map(&.mailbox.send_select_action(delivery))
......
......@@ -59,7 +59,9 @@ class PubRelay::WebServer::InboxHandler
end
def handle_forward(actor, request_body)
@subscription_manager.deliver(request_body, source_domain: actor.domain)
@subscription_manager.send(
SubscriptionManager::Deliver.new(request_body, source_domain: actor.domain)
)
end
private def error(status_code, error_code, user_message = "")
......
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