Skip to content

Commit

Permalink
chore: apply suggestions from code review
Browse files Browse the repository at this point in the history
Co-authored-by: Irakli Gozalishvili <contact@gozala.io>
  • Loading branch information
vasco-santos and Gozala committed Dec 9, 2020
1 parent 1992609 commit 9b863bd
Show file tree
Hide file tree
Showing 6 changed files with 11 additions and 11 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ jobs:
- uses: actions/checkout@v2
- run: yarn
- run: yarn lint
# - uses: gozala/typescript-error-reporter-action@v1.0.4
- uses: gozala/typescript-error-reporter-action@v1.0.8
- run: yarn build
- run: yarn aegir dep-check
- uses: ipfs/aegir/actions/bundle-size@master
Expand Down Expand Up @@ -64,4 +64,4 @@ jobs:
steps:
- uses: actions/checkout@v2
- run: yarn
- run: cd examples && yarn && npm run test -- auto-relay
- run: cd examples && yarn && npm run test -- auto-relay
4 changes: 2 additions & 2 deletions src/circuit/circuit/stop.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ const { validateAddrs } = require('./utils')
* Handles incoming STOP requests
*
* @private
* @param {object} options
* @param {Object} options
* @param {Connection} options.connection
* @param {CircuitPB} options.request - The CircuitRelay protobuf request (unencoded)
* @param {StreamHandler} options.streamHandler
Expand Down Expand Up @@ -50,7 +50,7 @@ module.exports.handleStop = function handleStop ({
* Creates a STOP request
*
* @private
* @param {object} options
* @param {Object} options
* @param {Connection} options.connection
* @param {CircuitPB} options.request - The CircuitRelay protobuf request (unencoded)
* @returns {Promise<MuxedStream|void>} Resolves a duplex iterable
Expand Down
1 change: 1 addition & 0 deletions src/circuit/circuit/stream-handler.js
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ class StreamHandler {
* Encode and write array of buffers
*
* @param {CircuitPB} msg - An unencoded CircuitRelay protobuf message
* @returns {void}
*/
write (msg) {
log('write message type %s', msg.type)
Expand Down
1 change: 0 additions & 1 deletion src/connection-manager/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,6 @@ const defaultOptions = {
*/

/**
* @extends EventEmitter
*
* @fires ConnectionManager#peer:connect Emitted when a new peer is connected.
* @fires ConnectionManager#peer:disconnect Emitted when a peer is disconnected.
Expand Down
10 changes: 5 additions & 5 deletions src/content-routing.js
Original file line number Diff line number Diff line change
Expand Up @@ -70,14 +70,14 @@ class ContentRouting {
* a provider of the given key.
*
* @param {CID} key - The CID key of the content to find
* @returns {Promise<void[]>}
* @returns {Promise<void>}
*/
async provide (key) { // eslint-disable-line require-await
async provide (key) {
if (!this.routers.length) {
throw errCode(new Error('No content routers available'), 'NO_ROUTERS_AVAILABLE')
}

return Promise.all(this.routers.map((router) => router.provide(key)))
await Promise.all(this.routers.map((router) => router.provide(key)))
}

/**
Expand All @@ -89,7 +89,7 @@ class ContentRouting {
* @param {number} [options.minPeers] - minimum number of peers required to successfully put
* @returns {Promise<void>}
*/
async put (key, value, options) { // eslint-disable-line require-await
put (key, value, options) {
if (!this.libp2p.isStarted() || !this.dht.isStarted) {
throw errCode(new Error(messages.NOT_STARTED_YET), codes.DHT_NOT_STARTED)
}
Expand All @@ -106,7 +106,7 @@ class ContentRouting {
* @param {number} [options.timeout] - optional timeout (default: 60000)
* @returns {Promise<GetData>}
*/
async get (key, options) { // eslint-disable-line require-await
get (key, options) {
if (!this.libp2p.isStarted() || !this.dht.isStarted) {
throw errCode(new Error(messages.NOT_STARTED_YET), codes.DHT_NOT_STARTED)
}
Expand Down
2 changes: 1 addition & 1 deletion src/ping/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ async function ping (node, peer) {

const { stream } = await node.dialProtocol(peer, PROTOCOL)

const start = new Date().getTime()
const start = Date.now()
const data = crypto.randomBytes(PING_LENGTH)

const [result] = await pipe(
Expand Down

0 comments on commit 9b863bd

Please sign in to comment.