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

Ensure queries stop after error or success #93

Merged
merged 1 commit into from
Mar 28, 2019

Conversation

dirkmc
Copy link
Contributor

@dirkmc dirkmc commented Mar 28, 2019

Currently queries continue running

  • after there was a timeout
  • after a match is found on one disjoint path (eg in find peer)

This PR changes the query function to return either pathComplete or queryComplete, where queryComplete indicates that the whole query should stop (not just this particular disjoint path)

It also ensures that queries are stopped after a timeout or any other error.

Copy link
Contributor

@jacobheun jacobheun left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Some minor feedback, overall this looks good, nice work!

src/index.js Outdated Show resolved Hide resolved
src/index.js Outdated Show resolved Hide resolved
src/query.js Show resolved Hide resolved
src/query.js Show resolved Hide resolved
test/query.spec.js Show resolved Hide resolved
Copy link
Member

@vasco-santos vasco-santos left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for this PR dirk!

Except for the things pointed out by Jacob, everything looks good to me 🚀

src/query.js Show resolved Hide resolved
src/query.js Show resolved Hide resolved
@@ -0,0 +1,42 @@
'use strict'
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks like this file was accidentally added?

Copy link
Contributor

@jacobheun jacobheun left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good! I've been testing this will my js-ipfs build locally and it looks good there as well.

Copy link
Member

@vasco-santos vasco-santos left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

@vasco-santos vasco-santos merged commit 0e55b20 into libp2p:master Mar 28, 2019
@ghost ghost removed the status/in-progress In progress label Mar 28, 2019
@vasco-santos
Copy link
Member

Released on 0.14.11

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

Successfully merging this pull request may close these issues.

3 participants