Skip to content
This repository has been archived by the owner on Jul 19, 2020. It is now read-only.

Code review #5

Open
lenak25 opened this issue Dec 1, 2019 · 11 comments
Open

Code review #5

lenak25 opened this issue Dec 1, 2019 · 11 comments

Comments

@lenak25
Copy link
Contributor

lenak25 commented Dec 1, 2019

Due to the lack of a better way for reviewing a repo, we've decided to open a new issue..

Great job, very clean and compact code!

Some minor comments:

  1. Docs:
    Great docs, clear and informative!
  1. Error checking:
  • If flags are not specified in the monitor CLI, than their default values are used and the code will raise an exception (reading from a null file / initializing WebsocketProvider with null, etc)
  • If there is an error in the file path/it is not a legit JSON, the code will raise an exception..
  • Could you please elaborate on the No need to try/catch. Let it throw. comments?
  1. Logs:
  • Why monitor's logs are written to strerr? I would expect them to be written to a file or to stdout but differently (with a different prefix perhaps)
  1. Peer discovery:
  • No need to dial on every peer:discovery, we need to dial to one bootstrap at the beginning and that's that, the DHT will take care of connecting us to the other peers.
  1. Topics:
  • Please consider moving the general topic names to a constants file.

Thanks!

@assafmo
Copy link
Member

assafmo commented Dec 1, 2019

  1. 👍
  2. If wrong values/no values are given as flags I thought it is okay to just let it crash with the error that caused the crash.
  3. It's a common practice in Linux to write data to stdout and logs to stderr. The user can easily redirect those to wherever.
  4. 👍. I think I saw this practice in libp2p's examples.
  5. 👍

@assafmo
Copy link
Member

assafmo commented Dec 1, 2019

Will fix all when I get back.

@lenak25
Copy link
Contributor Author

lenak25 commented Dec 2, 2019

  1. Makes sense, I've learned something new, thanks :)
  2. I am familiar with the example, I've taken a different approach in the node implementation (dialing only when required).. Lets spent some time to understand which approach is better (not urgent)

I have only now went through the test, also looks great, several comments:

a. The check of the subscription should test the subscription itself (messages sent to a subscribed topic are received) instead of checking the monitor's logs. You are doing this for the broadcast topic, you can do the same for the taskresult and the worker topics (by using the CLI publish command).

c. I think that both use cases - testing the monitor before and after the bootstrap start - can be more compact: the connection to the bootstrap and the subscription check can be done in the same it. If you prefer it this way, please reuse code by calling to a common function.

Thanks!

@assafmo
Copy link
Member

assafmo commented Dec 12, 2019

  1. Done: bdd9c0c, d70c328, e7c944b

@assafmo
Copy link
Member

assafmo commented Dec 12, 2019

  1. Done: 98b409e

@assafmo
Copy link
Member

assafmo commented Dec 12, 2019

  1. Resolved: Code review #5 (comment)

@assafmo
Copy link
Member

assafmo commented Dec 12, 2019

  1. Done: 3d4caac

@assafmo
Copy link
Member

assafmo commented Dec 12, 2019

  1. Done: 986859f

@assafmo
Copy link
Member

assafmo commented Dec 12, 2019

Tests:
a. I think it's best to black-box test this. This is why I'm reading the logs.

@assafmo
Copy link
Member

assafmo commented Dec 12, 2019

Tests:
c. Done: 2c96001

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants