RangerMauve / dat-archive-web

DatArchive implementation for browsers that uses dat-gateway
MIT License
30 stars 4 forks source link

Speed up time to ready #4

Closed sammacbeth closed 6 years ago

sammacbeth commented 6 years ago

Avoid the 3s timeout when setting up replication by using the metadata status. Is how node-dat-archive is checking for data availability when a new archive is created.

Testing with my DatArchive Test suite, this speeds up the initialisation enough to beat the 2s timeouts that these tests have.

RangerMauve commented 6 years ago

Does this event get emitted when the metadata is fully synced with a remote? Because that's kinda what I had the delay there for.

RangerMauve commented 6 years ago

Would you mind deleting the waitReplication() function and the REPLICATION_DELAY variable since it's no longer needed?

sammacbeth commented 6 years ago

That seems to be the case. I just saw the snippet in node-dat-archive and assume that is what is needed here too.

I've removed waitReplication() and REPLICATION_DELAY now.

RangerMauve commented 6 years ago

Awesome, thank you so much for the fix! I'll need to port it over to dat-gateway at some point, too. :D

RangerMauve commented 6 years ago

By the way, I've recently been working on some other improvements for dat-archive-web in order to support dat-polyfill better so master is a little bit ahead of what's on NPM.

Would you mind pointing to github in your package.json for the time being?

I'm not 100% sure how stable it is.