aboutsummaryrefslogtreecommitdiff
path: root/src/nostr_service.cpp
diff options
context:
space:
mode:
authorLibravatar dwigton <daniel@stonecottageweb.com>2024-07-15 12:05:09 -0500
committerLibravatar GitHub <noreply@github.com>2024-07-15 12:05:09 -0500
commit1e6bf40d457def0faa12e3f6cf58be0e9c69e6f5 (patch)
tree041ea8ca06a26fb6a25bcb30c9964cbceed69e74 /src/nostr_service.cpp
parent9cbe27d3e5e15a3790cc9d5d3e9cc5852ce08df4 (diff)
Apply suggestions from code review
Co-authored-by: Michael J <37635304+buttercat1791@users.noreply.github.com>
Diffstat (limited to 'src/nostr_service.cpp')
-rw-r--r--src/nostr_service.cpp32
1 files changed, 16 insertions, 16 deletions
diff --git a/src/nostr_service.cpp b/src/nostr_service.cpp
index 2c1f9a8..73cd602 100644
--- a/src/nostr_service.cpp
+++ b/src/nostr_service.cpp
@@ -183,9 +183,9 @@ tuple<vector<string>, vector<string>> NostrService::publishEvent(shared_ptr<Even
};
// TODO: Add a timeout to this method to prevent hanging while waiting for the relay.
-std::future<vector<shared_ptr<Event>>> NostrService::queryRelays(shared_ptr<Filters> filters)
+future<vector<shared_ptr<Event>>> NostrService::queryRelays(shared_ptr<Filters> filters)
{
- return std::async(std::launch::async, [this, filters]() -> vector<shared_ptr<Event>>
+ return async(launch::async, [this, filters]() -> vector<shared_ptr<Event>>
{
if (filters->limit > 64 || filters->limit < 1)
{
@@ -267,20 +267,20 @@ std::future<vector<shared_ptr<Event>>> NostrService::queryRelays(shared_ptr<Filt
// Close open subscriptions and disconnect from relays after events are received.
- for (auto& publishFuture : requestFutures)
- {
- auto [relay, isEose] = publishFuture.get();
- if (isEose)
- {
- PLOG_INFO << "Received EOSE message from relay " << relay;
- }
- else
- {
- PLOG_WARNING << "Received CLOSE message from relay " << relay;
- this->closeRelayConnections({ relay });
- }
- }
- this->closeSubscription(subscriptionId);
+ for (auto& publishFuture : requestFutures)
+ {
+ auto [relay, isEose] = publishFuture.get();
+ if (isEose)
+ {
+ PLOG_INFO << "Received EOSE message from relay " << relay;
+ }
+ else
+ {
+ PLOG_WARNING << "Received CLOSE message from relay " << relay;
+ this->closeRelayConnections({ relay });
+ }
+ }
+ this->closeSubscription(subscriptionId);
return events;
});