hyperledger / identus-edge-agent-sdk-ts

Apache License 2.0
20 stars 10 forks source link

Agent.stop doesn't close store #225

Open mixmix opened 4 months ago

mixmix commented 4 months ago

Is this a regression?

No

Description

We've written some persistence test for our application, but they fail because agent.stop does not stop all aspects of the agent. Namely the Pluto.Store continues to run, so that when you try and restart a new instance of the agent you get RxDB freaking out (correctly) about another instance of your db already running

Please provide the exception or error you saw

RxError (DB8): RxError (DB8):
  RxDB Error-Code DB8.
  Error messages are not included in RxDB core to reduce build size.
  - To find out what this error means, either use the dev-mode-plugin https://rxdb.info/dev-mode.html
  - or search for the error code here: https://github.com/pubkey/rxdb/search?q=DB8

Please provide the environment you discovered this bug in

SDK `5.1.1` with `@pluto-encrypted/inmemory`

Anything else?

Here's that Errror message looked up to save you the hassle : https://github.com/pubkey/rxdb/blob/c50e7c96f8f6bbaecefbb34673916f720c037edb/src/plugins/dev-mode/error-messages.ts#L68

    DB8: 'createRxDatabase(): A RxDatabase with the same name and adapter already exists.\n' +
        'Make sure to use this combination only once or set ignoreDuplicate to true if you do this intentional-\n' +
        'This often happens in react projects with hot reload that reloads the code without reloading the process.',
mixmix commented 4 months ago

Propose

inside agent.stop() add await this.store.stop() or whatever

mixmix commented 2 months ago

Bump