Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 5 additions & 2 deletions abstract.js
Original file line number Diff line number Diff line change
Expand Up @@ -310,13 +310,16 @@ function abstractPersistence (opts) {

const instance = await _persistence()
if (instance) {
// instance.broker must be set first because setting it triggers
// the call of instance._setup if aedes-cached-persistence is being used
// instance._setup then fires the 'ready'event
instance.broker = broker
// Wait for ready event, if applicable, to ensure the persistence isn't
// destroyed while it's still being set up.
// https://github.com/mcollina/aedes-persistence-redis/issues/41
if (waitForReady) {
if (waitForReady && !instance.ready) {
await waitForEvent(instance, 'ready')
}
instance.broker = broker
t.diagnostic('instance created')
return instance
}
Expand Down