Onyx-Protocol / Onyx

Onyx

Home Page:https://Onyx.org

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

bug: API returns 404 briefly after reset or configure

jeffomatic opened this issue · comments

For a small period after a /reset, the API returns a non-JSON 404 error message for all routes. I suspect this may also be the case for any core that is starting up, but I only noticed this issue when resetting from the dashboard.

The core ideally should not return any HTTP response until the API is fully ready, or should return some kind of temporary availability error (503), formatted as JSON.

Update: this occurs after a call to /configure as well.

commented

Yeah this is a known thing and happens for any core that's starting up. It is possible but not easy to fix.

It happens because the following three things must happen in order:

  1. https://github.com/chain/chain/blob/8e49351f/cmd/cored/main.go#L212
  2. https://github.com/chain/chain/blob/8e49351f/cmd/cored/main.go#L217
  3. https://github.com/chain/chain/blob/8e49351f/cmd/cored/main.go#L239-L247

cc @tessr

One other issue here is that it breaks SDK retry, because 404 is not considered to be a temporary/retriable error case.