Describe the bug
Method addNodes in maps.service.ts:
[Nest] 54 - 09/13/2024, 6:20:04 AM ERROR [WsExceptionsHandler] insert or update on table "mmp_node" violates foreign key constraint "FK_336300b82c56a05f0317f229420"
2024-09-13 08:20:03.972
at async MapsService.updateMap (/home/node/app/teammapper-backend/src/map/services/maps.service.ts:176:5)
2024-09-13 08:20:03.972
at async MapsService.addNodesFromClient (/home/node/app/teammapper-backend/src/map/services/maps.service.ts:80:12)
2024-09-13 08:20:03.972
at async reducer (/home/node/app/teammapper-backend/src/map/services/maps.service.ts:93:31)
2024-09-13 08:20:03.972
at async reducer (/home/node/app/teammapper-backend/src/map/services/maps.service.ts:95:40)
This method is called for pasting and importing a whole map. Investigate possible causes. Potential problems could be multiple concurrent json imports and a race condition, or the paste/cut functions.
Possible solutions
Importing a map should be a mutual exclusive operation, therefore, the map should be locked during this time. We could kill all socket connections to the map before and then do the import. And reload after the import is finished on the client side.
It's used when importing, copy/pasting but also when duplicating the map. Tried to reproduce with 3 clients, but I never managed to get this error even once. Maybe this'll be fixed once we merge #467.
Describe the bug Method
addNodes
inmaps.service.ts
:This method is called for pasting and importing a whole map. Investigate possible causes. Potential problems could be multiple concurrent json imports and a race condition, or the paste/cut functions.
Possible solutions Importing a map should be a mutual exclusive operation, therefore, the map should be locked during this time. We could kill all socket connections to the map before and then do the import. And reload after the import is finished on the client side.