JetBrains / aspire-plugin

.NET Aspire Plugin for JetBrains Rider
https://plugins.jetbrains.com/plugin/23289-aspire
MIT License
60 stars 0 forks source link

Only one database gets added to database panel if multiple databases are present #243

Closed Kralizek closed 4 days ago

Kralizek commented 2 months ago

Describe the bug My AppHost project contains more than database on the same PostgreSQL container. Only the first one is accessible from the Database panel.

To Reproduce

var password = builder.AddParameter("DatabasePassword").ExcludeFromManifest();

var database = builder.AddPostgres("postgres", password: password)
    .WithDataVolume("npgsql-experiment");

var dbOne = database.AddDatabase("db1");
var dbTwo = database.AddDatabase("db2");
var dbThree = database.AddDatabase("db3");

Expected behavior All database should be added to the panel when the application is started.

System information:

Kralizek commented 5 days ago

@rafaelldi were you able to reproduce this issue?

rafaelldi commented 5 days ago

No, unfortunately not. I've tried several times with different versions, and it all works well. If you could create a small repro project and describe the steps, that would be very helpful.

Kralizek commented 5 days ago

Here is a simple repro that already shows the behavior, but I'm not sure if this is because the databases are not created yet. If that's the case, I can fix that.

https://github.com/Kralizek/RiderAspireMultipleDatabases

rafaelldi commented 4 days ago

I have three of them. But not all the time, I'll check.

image

Kralizek commented 4 days ago

Having three of them happens 5% of the times (guesstimate)

rafaelldi commented 4 days ago

Thank you for your help! It should be fixed in the next release #283

Kralizek commented 4 days ago

I gave a quick look at the PR for curiosity. Now, my Kotlin knowledge amounts to the time I've been looking at your PR, but it feels weird it even showed more than one database at all.

Or am I blind to something in the previous code?

rafaelldi commented 4 days ago

There was a race. It depended on the order in which resources and connection strings came to us. Even if three connection strings had already arrived, we always chose one. But if they came one by one, everything was fine.