rokwire / surveys-building-block

Building Block that manages surveys in the Rokwire Platform.
Apache License 2.0
0 stars 1 forks source link

[BUG] Fix PerformTransaction #9

Closed roberlander2 closed 1 year ago

roberlander2 commented 1 year ago

Describe the bug The current implementation of storage.Adapter.PerformTransaction does not incorporate retries, which results in potential for WriteConflict errors and possibly others.

To Reproduce Steps to reproduce the behavior:

  1. Send multiple simultaneous requests that perform DB writes in a transaction
  2. See logged error message stating that a WriteConflict error occurred and the transaction should be retried

Expected behavior Use mongo.Session.WithTransaction instead of mongo.Client.UseSession, as Mongo's implementation of WithTransaction implements retry logic internally.

roberlander2 commented 1 year ago

This will depend on https://github.com/rokwire/logging-library-go/pull/24.