mirror of
https://github.com/hoytech/strfry.git
synced 2025-06-15 08:06:33 +00:00
use negentropy error message format specified in NIP-77
This commit is contained in:
@ -48,13 +48,17 @@ If a request cannot be serviced by the relay, an error is returned to the client
|
||||
]
|
||||
```
|
||||
|
||||
Current reason codes are:
|
||||
Error reasons are the same format as in NIP-01. They should begin with a machine-readable single-word prefix, followed by a `:` and then a human-readable message with more information.
|
||||
|
||||
* `RESULTS_TOO_BIG`
|
||||
The current suggested error reasons are
|
||||
|
||||
* `blocked`
|
||||
* Relays can optionally reject queries that would require them to process too many records, or records that are too old
|
||||
* The maximum number of records that can be processed can optionally be returned as the 4th element in the response
|
||||
* `CLOSED`
|
||||
* Because the `NEG-OPEN` queries are stateful, relays may choose to time-out inactive queries to recover memory resources
|
||||
* Example: `blocked: this query is too big`
|
||||
* `closed`
|
||||
* Because the `NEG-OPEN` queries may be stateful, relays may choose to time-out inactive queries to recover memory resources
|
||||
* Example: `closed: you took too long to respond!`
|
||||
|
||||
After a `NEG-ERR` is issued, the subscription is considered to be closed.
|
||||
|
||||
|
@ -149,7 +149,7 @@ void RelayServer::runNegentropy(ThreadPool<MsgNegentropy>::Thread &thr) {
|
||||
sendToConn(sub.connId, tao::json::to_string(tao::json::value::array({
|
||||
"NEG-ERR",
|
||||
sub.subId.str(),
|
||||
"RESULTS_TOO_BIG",
|
||||
"blocked: too many query results",
|
||||
cfg().relay__negentropy__maxSyncEvents
|
||||
})));
|
||||
|
||||
@ -228,7 +228,7 @@ void RelayServer::runNegentropy(ThreadPool<MsgNegentropy>::Thread &thr) {
|
||||
sendToConn(msg->connId, tao::json::to_string(tao::json::value::array({
|
||||
"NEG-ERR",
|
||||
msg->subId.str(),
|
||||
"CLOSED"
|
||||
"closed: unknown subscription handle"
|
||||
})));
|
||||
|
||||
continue;
|
||||
|
Reference in New Issue
Block a user