Skip to content

Commit

Permalink
Change default timeouts to being slow
Browse files Browse the repository at this point in the history
  • Loading branch information
Powersource committed Jul 4, 2023
1 parent 70dad05 commit a963994
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 2 deletions.
2 changes: 2 additions & 0 deletions lib/exclude.js
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@ function createNewEpoch(ssb, groupId, opts, cb) {
// prettier-ignore
if (opts?._reAddCrash) return cb(new Error('Intentional crash before re-adding members'))

console.log('i am', myRoot.id, 'about to reAdd members')
reAddMembers(
ssb,
groupId,
Expand Down Expand Up @@ -93,6 +94,7 @@ function reAddMembers(ssb, groupId, opts, cb) {

if (!missingMembers?.length) return cb()

console.log('about to readd', missingMembers)
pull(
pull.values(chunk(missingMembers, 15)),
pull.asyncMap((membersToAdd, cb) =>
Expand Down
6 changes: 6 additions & 0 deletions listeners.js
Original file line number Diff line number Diff line change
Expand Up @@ -254,6 +254,12 @@ module.exports = function startListeners(ssb, config, onError) {
if (preferredEpoch.id !== newPreferredEpoch.id)
return

console.log(
'i am',
myRoot.id,
'about to create new epoch'
)

createNewEpoch(ssb, group.id, null, (err) => {
// prettier-ignore
if (err && !isClosed) return onError(clarify(err, "Couldn't create new epoch to recover from a missing one"))
Expand Down
4 changes: 2 additions & 2 deletions test/helpers/testbot.js
Original file line number Diff line number Diff line change
Expand Up @@ -57,8 +57,8 @@ module.exports = function createSbot(opts = {}) {
seed: opts.mfSeed || mfSeedFromName(opts.name),
},
tribes2: {
timeoutLow: opts.timeoutLow ?? 0.05,
timeoutHigh: opts.timeoutHigh ?? 0.2,
timeoutLow: opts.timeoutLow,
timeoutHigh: opts.timeoutHigh,
},
})

Expand Down
9 changes: 9 additions & 0 deletions test/list-members.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -162,6 +162,8 @@ test('listMembers works with exclusion', async (t) => {
'00000000000000000000000000000000000000000000000000000000000ca201',
'hex'
),
timeoutLow: 0.5,
timeoutHigh: 0.7,
})
const david = Testbot({
keys: ssbKeys.generate(null, 'david'),
Expand All @@ -184,6 +186,12 @@ test('listMembers works with exclusion', async (t) => {
p(carol.metafeeds.findOrCreate)(),
p(david.metafeeds.findOrCreate)(),
])
console.log({
alice: aliceRoot.id,
bob: bobRoot.id,
carol: carolRoot.id,
david: davidRoot.id,
})

await Promise.all([
replicate(alice, bob),
Expand Down Expand Up @@ -243,6 +251,7 @@ test('listMembers works with exclusion', async (t) => {

await Promise.all([replicate(alice, bob), replicate(alice, carol)])

t.pass('replicate done')
await p(setTimeout)(500)
t.deepEquals(
liveMembers.sort(),
Expand Down

0 comments on commit a963994

Please sign in to comment.