stellar / go

Stellar's public monorepo of go code
https://stellar.org/developers
Apache License 2.0
1.29k stars 503 forks source link

services/horizon: cannot stream accounts #4133

Open kalepail opened 2 years ago

kalepail commented 2 years ago

What version are you using?

Whatever laboratory is using.

What did you do?

Trying to stream accounts with an asset filter

You can try this for yourself by going to the Laboratory/testnet and attempting to stream accounts.

What did you expect to see?

A stream of accounts.

What did you see instead?

{
  "type": "https://stellar.org/horizon-errors/not_acceptable",
  "title": "An acceptable response content-type could not be provided for this request",
  "status": 406
}
paulbellamy commented 2 years ago

I don't think accounts are streamable. The docs don't indicate that they are. And the handler is not a streamable handler.

kalepail commented 2 years ago
  1. https://stellar.github.io/js-stellar-sdk/AccountCallBuilder.html#stream

  2. https://laboratory.stellar.org/#explorer?resource=accounts&endpoint=multiple Screen Shot 2021-12-09 at 8 36 11 AM

  3. https://developers.stellar.org/api/introduction/streaming/ Screen Shot 2021-12-09 at 8 36 46 AM

If we don't support streaming on accounts we need to update the above. Which would also beg the question are there other endpoints we say we stream that we actually don't?

ire-and-curses commented 2 years ago

@bartekn wondering if we changed this some time ago. Do you remember?

paulbellamy commented 2 years ago

Ok, the docs I checked show it as not streamable, so there is definitely a discrepancy there. Does laboratory just show everything as streamable, maybe?

What did you expect streaming accounts to return? i.e. When would you expect it to stream a new account? at creation? whenever the balance changes? etc?

kalepail commented 2 years ago

A lot of them do but claimable balances for example do not. So there's some sort of true/false logic there somewhere cc: @quietbits

I would expect a stream to return values whenever it would have been included in a non-streamed response. So just all accounts or whenever a filter begins to match in this case. Most of my use case is just in instances where paging through +5000 records is a rate limit risk or the cursor/sort could miss something and streaming would, I hope, be more efficient or accurate.