Limit number of relays to publish zap receipts to
This commit is contained in:
@@ -6,11 +6,35 @@ RSpec.describe NostrManager::PublishZapReceipt, type: :model do
|
||||
|
||||
describe "Default/delayed execution" do
|
||||
it "publishes zap receipts to all requested relays" do
|
||||
2.times do
|
||||
expect(NostrPublishEventJob).to receive(:perform_later).and_return(true)
|
||||
end
|
||||
expect(NostrPublishEventJob).to receive(:perform_later)
|
||||
.exactly(2).times.and_return(true)
|
||||
|
||||
described_class.call(zap: zap)
|
||||
end
|
||||
|
||||
context "with a long relay list" do
|
||||
before do
|
||||
relays = zap.request["tags"].find { |t| t.first == "relays" }
|
||||
[
|
||||
"wss://aegonstargaryen.example.com", "wss://visenya.example.com",
|
||||
"wss://rhaenys.example.com", "wss://housevelaryon.example.com",
|
||||
"wss://aemond.example.com", "wss://jaehaerys.example.com",
|
||||
"wss://daenerys.example.com", "wss://corlys.example.com",
|
||||
"wss://laenor.example.com", "wss://alysanne.example.com",
|
||||
"wss://balerion.example.com", "wss://meraxes.example.com",
|
||||
"wss://vhaegar.example.com", "wss://vermax.example.com",
|
||||
"wss://caraxes.example.com"
|
||||
].each do |url|
|
||||
relays << url
|
||||
end
|
||||
end
|
||||
|
||||
it "limits publishing attempts to the first 12 relays" do
|
||||
expect(NostrPublishEventJob).to receive(:perform_later)
|
||||
.exactly(12).times.and_return(true)
|
||||
|
||||
described_class.call(zap: zap)
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user