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

Saving connection configuration violates a unique constraint #3

Open
instantiator opened this issue Aug 23, 2020 · 0 comments
Open
Labels
bug Something isn't working show-stopper This issue breaks a whole feature (or the whole tool)

Comments

@instantiator
Copy link
Owner

instantiator commented Aug 23, 2020

On saving RoboConfig from the connection page, a unique constraint is violated in the db.

VectorPlus.Web.Service.VectorPlusBackgroundService.StoreRoboConfig(RoboConfig config) in VectorPlusBackgroundService.cs
+
db.SaveChanges();
VectorPlus.Web.Service.VectorPlusBackgroundService.SetRoboConfigAsync(string robotName, string robotSerial, string email, string password, string ipOverride) in VectorPlusBackgroundService.cs
+
StoreRoboConfig(roboConfig); // store final version with cert and guid
VectorPlus.Web.Controllers.ConnectionController.UpdateAsync(ConnectionViewModel model) in ConnectionController.cs
+
var response = await service.SetRoboConfigAsync(
Microsoft.AspNetCore.Mvc.Infrastructure.ActionMethodExecutor+TaskOfIActionResultExecutor.Execute(IActionResultTypeMapper mapper, ObjectMethodExecutor executor, object controller, object[] arguments)
System.Threading.Tasks.ValueTask<TResult>.get_Result()
System.Runtime.CompilerServices.ValueTaskAwaiter<TResult>.GetResult()

118428435_10164622986585019_6646985092555608700_o

NB. The RoboConfig should be a singleton in the database. This should be fixable by first searching for and removing any existing RoboConfig entries before saving the new one.

To be confirmed: I had believed this was already happening.

The issue could relate to a recent change that switches from creating a database context for each operation, to retaining a long-lived singleton database context.

If that's the case, the issue may be that transaction management needs to be implemented, so that operations can be flushed to the database in order.

@instantiator instantiator added the bug Something isn't working label Aug 23, 2020
@instantiator instantiator changed the title Saving connection configuration is broken Saving connection configuration violates a unique constraint Aug 23, 2020
@instantiator instantiator added the show-stopper This issue breaks a whole feature (or the whole tool) label Aug 23, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working show-stopper This issue breaks a whole feature (or the whole tool)
Projects
None yet
Development

No branches or pull requests

1 participant