Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unable to reinitialize agent once shut downed #2135

Open
GHkrishna opened this issue Dec 18, 2024 · 3 comments
Open

Unable to reinitialize agent once shut downed #2135

GHkrishna opened this issue Dec 18, 2024 · 3 comments

Comments

@GHkrishna
Copy link
Contributor

What:

Reinitializing agent with await agent.initialize() after await agent.shutdown() gives an indyVdr error due to this implementation. Should we just return instead of throwing error:

public connect() {
    if (this._pool) {
      throw new IndyVdrError('Cannot connect to pool, already connected.')
    }

    this._pool = new PoolCreate({
      parameters: {
        transactions: this.config.genesisTransactions,
      },
    })
  }

This becomes,

public connect() {
    if (this._pool) {
      return
    }

    this._pool = new PoolCreate({
      parameters: {
        transactions: this.config.genesisTransactions,
      },
    })
  }

To reproduce

  1. await agent.shutdown()
  2. await agent.initialize()

Version

"@credo-ts/indy-vdr": "0.5.13"

@TimoGlastra
Copy link
Contributor

I think the better approach would be to shutdown the pool at agent shutdown and remove the value initialization

@GHkrishna
Copy link
Contributor Author

GHkrishna commented Dec 24, 2024

The issue for shutting down of pool still exists in IndyVDR. For now I think we can set the initialized value to null. And once it is resolved in VDR we can retro fit it. What do you think?

@TimoGlastra
Copy link
Contributor

Yes i think that makes sense. But since we can't close it we should reuse the existing pool on initialize again

GHkrishna added a commit to GHkrishna/credo-ts that referenced this issue Dec 27, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants