@comapeo/core 4.1.1 → 4.1.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/discovery/local-discovery.d.ts.map +1 -1
- package/dist/index-writer/index.d.ts.map +1 -1
- package/dist/sync/peer-sync-controller.d.ts.map +1 -1
- package/package.json +1 -1
- package/src/discovery/local-discovery.js +6 -2
- package/src/index-writer/index.js +12 -10
- package/src/invite/invite-state-machine.js +2 -2
- package/src/mapeo-manager.js +2 -2
- package/src/sync/peer-sync-controller.js +3 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"local-discovery.d.ts","sourceRoot":"","sources":["../../src/discovery/local-discovery.js"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"local-discovery.d.ts","sourceRoot":"","sources":["../../src/discovery/local-discovery.js"],"names":[],"mappings":"AAyBA,mDAAmD;AAEnD;;;GAGG;AAEH;;GAEG;AACH;IAaE;;;;OAIG;IACH,yCAHG;QAAsB,eAAe,EAA7B,OAAO;QACO,MAAM;KAAC,EAqB/B;IAED,yDAAyD;IACzD,SADc,OAAO,CAAC;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,IAAI,EAAE,MAAM,CAAA;KAAE,CAAC,CAIpD;IAqBD;;;;;;OAMG;IACH,qCALG;QAAqB,OAAO,EAApB,MAAM;QACO,IAAI,EAAjB,MAAM;QACO,IAAI,EAAjB,MAAM;KACd,GAAU,IAAI,CAkBhB;IAqJD;;;;;;;;;OASG;IACH;;;oBAFa,OAAO,CAAC,IAAI,CAAC,CAIzB;;CA+BF;sBA5Sa;IAAE,SAAS,EAAE,MAAM,CAAC;IAAC,SAAS,EAAE,MAAM,CAAA;CAAE;mCACxC,kBAAkB,GAAG,CAAC,MAAM,CAAC;;gBAc7B,CAAC,UAAU,EAAE,oBAAoB,KAAK,IAAI;;6BA7B3B,oBAAoB;uBAU1B,cAAc;gBATrB,UAAU;uCAWa,uCAAuC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index-writer/index.js"],"names":[],"mappings":"AAMA,mEAAmE;AACnE,6DAA6D;AAE7D;;GAEG;AACH;;GAEG;AAEH;;GAEG;AACH,yBAF+B,OAAO,SAAzB,cAAgB;IAY3B;;;;;;;;OAQG;IACH,2DANG;QAAgD,MAAM,EAA9C,OAAO,gBAAgB,EAAE,QAAQ;QACjB,MAAM,EAAtB,OAAO,EAAE;QAC4D,MAAM,UAArE,gBAAgB,WAAW,eAAe,KAAK,QAAQ;QACE,SAAS;QAC1D,MAAM;KAAC,EAiB/B;IAED;;OAEG;IACH,8CAEC;IAED;;;OAGG;IACH,eAHW,OAAO,oBAAoB,EAAE,KAAK,EAAE,GAClC,OAAO,CAAC,aAAa,CAAC,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index-writer/index.js"],"names":[],"mappings":"AAMA,mEAAmE;AACnE,6DAA6D;AAE7D;;GAEG;AACH;;GAEG;AAEH;;GAEG;AACH,yBAF+B,OAAO,SAAzB,cAAgB;IAY3B;;;;;;;;OAQG;IACH,2DANG;QAAgD,MAAM,EAA9C,OAAO,gBAAgB,EAAE,QAAQ;QACjB,MAAM,EAAtB,OAAO,EAAE;QAC4D,MAAM,UAArE,gBAAgB,WAAW,eAAe,KAAK,QAAQ;QACE,SAAS;QAC1D,MAAM;KAAC,EAiB/B;IAED;;OAEG;IACH,8CAEC;IAED;;;OAGG;IACH,eAHW,OAAO,oBAAoB,EAAE,KAAK,EAAE,GAClC,OAAO,CAAC,aAAa,CAAC,CAiDlC;IAED;;OAEG;IACH,qDAMC;;CACF;4BAnHY,GAAG,CAA2B,IAAtB,QAAQ,CAAC,YAAY,CAAC,CAAC,CAAC,EAAE,MAAM,EAAE,GAAE;+BAG5C,UAAU,CAAC,OAAO,MAAM,CAAC;oCANF,sBAAsB;qCADX,iBAAiB;8BAAjB,iBAAiB;uBADzC,cAAc;uBALd,iBAAiB"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"peer-sync-controller.d.ts","sourceRoot":"","sources":["../../src/sync/peer-sync-controller.js"],"names":[],"mappings":"AAKA,6DAA6D;AAC7D,0CAA0C;AAC1C,wDAAwD;AACxD,+CAA+C;AAC/C,iFAAiF;AAEjF;;GAEG;AAEH;IAsBE;;;;;;;OAOG;IACH,iEANG;QAAoD,QAAQ,EAApD,OAAO,UAAU,EAAE,iBAAiB,CAAC;QACgB,WAAW,EAAhE,OAAO,0BAA0B,EAAE,WAAW;QACJ,SAAS,EAAnD,OAAO,iBAAiB,EAAE,SAAS;QACD,KAAK,EAAvC,OAAO,aAAa,EAAE,KAAK;QACb,MAAM;KAAC,EAkB/B;IAED,sBAEC;IAED,qBAEC;IAED,gGAEC;IAED,iDAAiD;IACjD,sCADY,gBAAgB,QAO3B;IAED;;OAEG;IACH,iCAFW,MAAM,QAoBhB;;
|
|
1
|
+
{"version":3,"file":"peer-sync-controller.d.ts","sourceRoot":"","sources":["../../src/sync/peer-sync-controller.js"],"names":[],"mappings":"AAKA,6DAA6D;AAC7D,0CAA0C;AAC1C,wDAAwD;AACxD,+CAA+C;AAC/C,iFAAiF;AAEjF;;GAEG;AAEH;IAsBE;;;;;;;OAOG;IACH,iEANG;QAAoD,QAAQ,EAApD,OAAO,UAAU,EAAE,iBAAiB,CAAC;QACgB,WAAW,EAAhE,OAAO,0BAA0B,EAAE,WAAW;QACJ,SAAS,EAAnD,OAAO,iBAAiB,EAAE,SAAS;QACD,KAAK,EAAvC,OAAO,aAAa,EAAE,KAAK;QACb,MAAM;KAAC,EAkB/B;IAED,sBAEC;IAED,qBAEC;IAED,gGAEC;IAED,iDAAiD;IACjD,sCADY,gBAAgB,QAO3B;IAED;;OAEG;IACH,iCAFW,MAAM,QAoBhB;;CAuMF;wBAGY,GAAG,SAAsB,IAAT,SAAS,CAAC,CAAC,EAAE,OAAO,sBAAsB,EAAE,kBAAkB,GAAE;yBAG/E,MAAM,CAAC,SAAS,EAAE,SAAS,GAAG,SAAS,GAAG,QAAQ,CAAC;6BA1SpD,IAAI,CAAC,MAAM,CAAC,CAAC,SAAS,CAAC,GAAG,SAAS;sCALV,eAAe;uCAEd,uCAAuC;uBAPvD,cAAc;+BAMN,aAAa;0BAFlB,aAAa"}
|
package/package.json
CHANGED
|
@@ -15,9 +15,13 @@ import { getErrorCode } from '../lib/error.js'
|
|
|
15
15
|
/** @typedef {{ publicKey: Buffer, secretKey: Buffer }} Keypair */
|
|
16
16
|
/** @typedef {OpenedNoiseStream<net.Socket>} OpenedNetNoiseStream */
|
|
17
17
|
|
|
18
|
+
/** @satisfies {import('node:net').ServerOpts | import('node:net').TcpNetConnectOpts} */
|
|
18
19
|
const TCP_KEEP_ALIVE_OPTIONS = {
|
|
19
20
|
keepAlive: true,
|
|
20
|
-
keepAliveInitialDelay:
|
|
21
|
+
keepAliveInitialDelay: 30_000,
|
|
22
|
+
// Turn off Nagle's algorythm, to reduce latency
|
|
23
|
+
// https://github.com/digidem/comapeo-core/issues/1070
|
|
24
|
+
noDelay: true,
|
|
21
25
|
}
|
|
22
26
|
export const ERR_DUPLICATE = 'Duplicate connection'
|
|
23
27
|
|
|
@@ -108,9 +112,9 @@ export class LocalDiscovery extends TypedEmitter {
|
|
|
108
112
|
return
|
|
109
113
|
}
|
|
110
114
|
const socket = net.connect({
|
|
115
|
+
...TCP_KEEP_ALIVE_OPTIONS,
|
|
111
116
|
host: address,
|
|
112
117
|
port,
|
|
113
|
-
...TCP_KEEP_ALIVE_OPTIONS,
|
|
114
118
|
})
|
|
115
119
|
socket.on('error', this.#handleSocketError)
|
|
116
120
|
socket.once('connect', () => {
|
|
@@ -97,16 +97,18 @@ export class IndexWriter {
|
|
|
97
97
|
const indexer = this.#indexers.get(schemaName)
|
|
98
98
|
if (!indexer) continue // Won't happen, but TS doesn't know that
|
|
99
99
|
indexer.batch(docs)
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
100
|
+
// TODO: selectively turn this on when log level is 'trace' or 'debug'
|
|
101
|
+
// Otherwise this has a big performance overhead because this is all synchronous
|
|
102
|
+
// if (this.#l.log.enabled) {
|
|
103
|
+
// for (const doc of docs) {
|
|
104
|
+
// this.#l.log(
|
|
105
|
+
// 'Indexed %s %S @ %S',
|
|
106
|
+
// doc.schemaName,
|
|
107
|
+
// doc.docId,
|
|
108
|
+
// doc.versionId
|
|
109
|
+
// )
|
|
110
|
+
// }
|
|
111
|
+
// }
|
|
110
112
|
}
|
|
111
113
|
return indexed
|
|
112
114
|
}
|
|
@@ -4,8 +4,8 @@ import { InviteResponse_Decision } from '../generated/rpc.js'
|
|
|
4
4
|
import ensureError from 'ensure-error'
|
|
5
5
|
import { TimeoutError } from '../errors.js'
|
|
6
6
|
|
|
7
|
-
const RECEIVE_PROJECT_DETAILS_TIMEOUT_MS =
|
|
8
|
-
const ADD_PROJECT_TIMEOUT_MS =
|
|
7
|
+
const RECEIVE_PROJECT_DETAILS_TIMEOUT_MS = 45_000
|
|
8
|
+
const ADD_PROJECT_TIMEOUT_MS = 45_000
|
|
9
9
|
|
|
10
10
|
/** @import { StringToTaggedUnion } from '../types.js' */
|
|
11
11
|
/** @import { ProjectJoinDetails } from '../generated/rpc.js' */
|
package/src/mapeo-manager.js
CHANGED
|
@@ -708,14 +708,14 @@ export class MapeoManager extends TypedEmitter {
|
|
|
708
708
|
*
|
|
709
709
|
* @param {MapeoProject} project
|
|
710
710
|
* @param {object} [opts]
|
|
711
|
-
* @param {number} [opts.timeoutMs=
|
|
711
|
+
* @param {number} [opts.timeoutMs=300_000] Timeout in milliseconds for max time
|
|
712
712
|
* to wait between sync status updates before giving up. As long as syncing is
|
|
713
713
|
* happening, this will never timeout, but if more than timeoutMs passes
|
|
714
714
|
* without any sync activity, then this will resolve `false` e.g. data has not
|
|
715
715
|
* synced
|
|
716
716
|
* @returns {Promise<boolean>}
|
|
717
717
|
*/
|
|
718
|
-
async #waitForInitialSync(project, { timeoutMs =
|
|
718
|
+
async #waitForInitialSync(project, { timeoutMs = 300_000 } = {}) {
|
|
719
719
|
const [ownRole, isProjectSettingsSynced] = await Promise.all([
|
|
720
720
|
project.$getOwnRole(),
|
|
721
721
|
project.$hasSyncedProjectSettings(),
|
|
@@ -132,7 +132,9 @@ export class PeerSyncController {
|
|
|
132
132
|
const localState = mapObject(state, (ns, nsState) => {
|
|
133
133
|
return [ns, nsState.localState]
|
|
134
134
|
})
|
|
135
|
-
this
|
|
135
|
+
// TODO: Turn this on when log level is 'trace' or 'debug'
|
|
136
|
+
// This logs _a lot_ of data, which has a performance overhead
|
|
137
|
+
// this.#log('state %X', state)
|
|
136
138
|
|
|
137
139
|
// Map of which namespaces have received new data since last sync change
|
|
138
140
|
const didUpdate = mapObject(state, (ns) => {
|