Fix trace store data base race
Add a test that tries to fetch results and store them in the data base and use timeouts to ensure that a race condition is created. Add a secondary check to see whether an result is already in the data base before storing it, so that no duplicate entries of traces are created.