Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Handle 404 when updating status #148

Open
Ivshti opened this issue Jul 17, 2020 · 1 comment · May be fixed by #157
Open

Handle 404 when updating status #148

Ivshti opened this issue Jul 17, 2020 · 1 comment · May be fixed by #157
Assignees

Comments

@Ivshti
Copy link
Member

Ivshti commented Jul 17, 2020

Behavior

When the channel is not submitted to one of the validators, an exception occurs:

=== ERROR IN GET REQUEST ===
Error: Fetch error at "https://jerry.moonicorn.network/channel/0x185ae00b64202387ce62468a0689e5bc31ba4dca8eace0bdd6d28e5cd3b5ff8c/last-approved?withHeartbeat=true", status: [404] Not Found, err: null 
    at /home/ivo/repos/adex-market/helpers/getRequest.js:11:11
    at processTicksAndRejections (internal/process/task_queues.js:97:5)
    at async Promise.all (index 0)
    at async getStatusOfCampaign (/home/ivo/repos/adex-market/status-loop/queryValidators.js:100:57)
    at async Promise.all (index 0)
    at async queryValidators (/home/ivo/repos/adex-market/status-loop/queryValidators.js:214:2)
(node:3794577) UnhandledPromiseRejectionWarning: Error: Error: Fetch error at "https://jerry.moonicorn.network/channel/0x185ae00b64202387ce62468a0689e5bc31ba4dca8eace0bdd6d28e5cd3b5ff8c/last-approved?withHeartbeat=true", status: [404] Not Found, err: null 
    at /home/ivo/repos/adex-market/helpers/getRequest.js:19:10
    at processTicksAndRejections (internal/process/task_queues.js:97:5)
    at async Promise.all (index 0)
    at async getStatusOfCampaign (/home/ivo/repos/adex-market/status-loop/queryValidators.js:100:57)
    at async Promise.all (index 0)
    at async queryValidators (/home/ivo/repos/adex-market/status-loop/queryValidators.js:214:2)
(node:3794577) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). To terminate the node process on unhandled promise rejection, use the CLI flag `--unhandled-rejections=strict` (see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 1)
(node:3794577) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.

Expected behavior

Either catch the 404 and don't set a status (skip it) or set a status that's appropriate, e.g Initializing - the problem with this is that the other properties will be missing.

To be discussed.

@elpiel
Copy link
Member

elpiel commented Jul 20, 2020

Good catch! I think even in the Rust impl it will cause similar issue.

  1. First the issue will come from is_finalized(), since we call the Leader
  2. The second time is before calling is_initializing() for the Follower.

These are the 2 places we need to fix.

I propose the following:

TODOs in Rust get_status()

  • {}/last-approved call should handle Http Status: 404
  • Handle None(?) case for Leader
  • Handle None(?) case for Follower

Regarding the status @Ivshti , there shouldn't be a problem. We return the Leader BalancesMap with the Status::Initializing and we can just return an empty one.

@simzzz simzzz linked a pull request Aug 27, 2020 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants