-
Notifications
You must be signed in to change notification settings - Fork 19
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
Make the PinnerConnector great again #1086
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This looks good! The only thing I think is worth a look is the debug env var for pinner; it'd be better if that were configurable.
@@ -17,7 +17,10 @@ export const raceAgainstTimeout = async ( | |||
timeout = setTimeout(() => reject(throwError), ms); | |||
}); | |||
try { | |||
return Promise.race([timeoutPromise, promise]); | |||
// To be able to use the async error handling here, we need to explicitly |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Wow, new to me, great find (and thanks for the comment).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah idk, might have to do with Babel transpilation? We might want to test this
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Had a quick google, I was suspecting it could have been, but haven't found anything exactly like this.
scripts/start_all.js
Outdated
stdio: 'pipe', | ||
env: { | ||
...process.env, | ||
DEBUG: 'pinner:*', |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe we could get this from process.env
under another name? Perhaps we won't want debugging on by default.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah you might be right. There's a lot of output there.
@@ -156,6 +168,17 @@ class PinnerConnector extends EventEmitter { | |||
this._roomMonitor.on('error', log); | |||
} | |||
|
|||
async ready() { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good 👍
src/lib/ipfs/PinnerConnector.js
Outdated
@@ -179,12 +202,15 @@ class PinnerConnector extends EventEmitter { | |||
type: PIN_ACTIONS.LOAD_STORE, | |||
payload: { address }, | |||
}); | |||
return raceAgainstTimeout( | |||
const [heads] = await raceAgainstTimeout( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Huh, yeah, I don't know how it worked before either 🤷♂️
Did you try this locally @JamesLefrere? |
Oops, I didn't see this. Will do 👍 |
I'm putting this back into in-progress as it seems we're far from done here. |
6bdbf32
to
0d4f9ce
Compare
On hold until @thiagodelgado111 merges the orbit-db upstream PR |
0d4f9ce
to
f47fac9
Compare
f47fac9
to
73808ef
Compare
it might be worthwhile finding out why we need to debounce this in the first placeThis comment was generated by todo based on a
|
Improve error modes for failed pinned store requestsThis could be dangerous in case of an unfinished replication. We have to account for that Quick fix could be to just also wait for the full replication, which might be a performance hit This comment was generated by todo based on a
|
fae39c8
to
e325a60
Compare
Improve replication checkThis is not super accurate as the pinner could have the same number of heads but different ones. This can be improved but checking other internal states (like orbit stores do?). For now it's probably ok. Also, maybe it doesn't really need to be super accurate, as we're replicating anyways. This comment was generated by todo based on a
|
0b278da
to
2a13fb1
Compare
0e9bd11
to
624c520
Compare
One thing that I noticed though:
This seems to be a problem with |
Hmm, @thiagodelgado111 I think that's our fault. Let me see. |
Until - orbitdb/orbitdb#606 and - orbitdb-archive/orbit-db-store#38 are merged
* Instead of relying on our Orbit patch to listen for `peer.exchange` events (which can be unreliable), wait for at least one head to appear locally with a timeout (horrible, but slightly less unreliable).
1107a91
to
5d51c7b
Compare
Description
This PR fixes a few things related to the pinner. Wow this took quite some time but I got it!
New stuff ✨
yarn dev
Changes 🏗
86b12cdd048ea7d5fa5a615adf6a2126d3084794
(shorter store names)f98c1bbf5103aa79b63a3370c1824a5d329f908b
(adjusted scripts and updated dependencies)PinnerConnector
andraceAgainstTimeout
Store
<->PinnerConnector
connection more resilientDeletions ⚰️
Notes 📒
Please wipe your
node_modules
folder and update the submodules after this is merged:To the reviewers: Please test that it works for you!
Resolves #1077