rqlite / gorqlite

A Go client for rqlite, the distributed database built on SQLite
MIT License
139 stars 34 forks source link

gracefully handle store not open statuses #36

Closed dylrich closed 5 months ago

dylrich commented 6 months ago

If rqlite's store is not yet open, the store status JSON looks like:

{
  "open": false
}

There is no other information included. This causes gorqlite to panic because we assume there is always a "leader" field filled out, which is not the case before the store has opened.

I wasn't sure if this is exactly the way you'd like this fixed; technically we could change rqlite to have this information in the status endpoint as well, I think? I also wasn't too sure how to add a test for this, but would be willing to add one if you could point me to the proper place.

Thanks!

otoolep commented 6 months ago

Thanks for this -- I have not looked at the code this changes. Is this in response to a fetch of the /status endpoint?

dylrich commented 5 months ago

Hi! Sorry, I missed your comment. Yes, this panic happens when parsing a /status response.

otoolep commented 5 months ago

Thanks for your contribution.