Use timestamp with milliseconds resolution for prevent race condition

sonarcloud
(Vitaly Karasik) #1

From time to time we encountering a race condition where are two scans are submitting in the same second and as a result one of them failing with:

Error Details

Validation of project failed: o Date of analysis cannot be older than the date of the last known analysis on this project. Value: “2019-05-12T13:01:56+0200”. Latest analysis: “2019-05-12T13:01:56+0200”. It’s only possible to rebuild the past in a chronological order.

I suggest to use timestamp with millisecond resolution.

(Janos Gyerik) #2

Can you please explain a bit more about the use case? I don’t expect two analysis triggered in the same second to produce different results. It looks like one of them is a waste that would be good to eliminate, rather than letting through.

(Vitaly Karasik) #3

In our CI we trigger two jobs for each PR - one for the ‘head’ and the second for ‘merged’ code. So if there 2 free Jenkins agents, jobs are starting simultaneously.