braid-text 0.2.88 → 0.2.89
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/index.js +11 -2
- package/package.json +1 -1
package/index.js
CHANGED
|
@@ -99,11 +99,14 @@ function create_braid_text() {
|
|
|
99
99
|
var local_first_put
|
|
100
100
|
var local_first_put_promise = new Promise(done => local_first_put = done)
|
|
101
101
|
|
|
102
|
+
var waitTime = 1
|
|
102
103
|
function handle_error(_e) {
|
|
103
104
|
if (closed) return
|
|
104
105
|
disconnect()
|
|
105
|
-
|
|
106
|
-
|
|
106
|
+
var delay = waitTime * 1000
|
|
107
|
+
console.log(`disconnected, retrying in ${waitTime} second${waitTime > 1 ? 's' : ''}`)
|
|
108
|
+
setTimeout(connect, delay)
|
|
109
|
+
waitTime = Math.min(waitTime + 1, 3)
|
|
107
110
|
}
|
|
108
111
|
|
|
109
112
|
connect()
|
|
@@ -173,6 +176,7 @@ function create_braid_text() {
|
|
|
173
176
|
async function send_out(update) {
|
|
174
177
|
update.signal = ac.signal
|
|
175
178
|
update.dont_retry = true
|
|
179
|
+
if (options.peer) update.peer = options.peer
|
|
176
180
|
var x = await braid_text.put(b, update)
|
|
177
181
|
if (x.ok) {
|
|
178
182
|
local_first_put()
|
|
@@ -200,6 +204,7 @@ function create_braid_text() {
|
|
|
200
204
|
signal: temp_ac.signal,
|
|
201
205
|
parents: frontier,
|
|
202
206
|
merge_type: 'dt',
|
|
207
|
+
peer: options.peer,
|
|
203
208
|
subscribe: u => u.version?.length && q.push(u)
|
|
204
209
|
}
|
|
205
210
|
await braid_text.get(a, temp_ops)
|
|
@@ -234,6 +239,7 @@ function create_braid_text() {
|
|
|
234
239
|
var a_ops = {
|
|
235
240
|
signal: ac.signal,
|
|
236
241
|
merge_type: 'dt',
|
|
242
|
+
peer: options.peer,
|
|
237
243
|
subscribe: update => {
|
|
238
244
|
if (closed) return
|
|
239
245
|
if (update.version?.length) {
|
|
@@ -255,6 +261,9 @@ function create_braid_text() {
|
|
|
255
261
|
signal: ac.signal,
|
|
256
262
|
dont_retry: true,
|
|
257
263
|
headers: { 'Merge-Type': 'dt', 'accept-encoding': 'updates(dt)' },
|
|
264
|
+
parents: resource.meta.fork_point,
|
|
265
|
+
peer: options.peer,
|
|
266
|
+
heartbeats: 120,
|
|
258
267
|
subscribe: async update => {
|
|
259
268
|
// Wait for remote_res to be available
|
|
260
269
|
await remote_res_promise
|