Latency in result update

background_task

(durgesh) #1

Hi All,
Is there latency in updation of result from sonarqube, after analysis, i use curl to REST API using project key to get me the result in json, seen that sometime it fetch the old result.
sonarqube: 7.2 community edition
REST API: http://localhost:9000/api/ce/submit?projectKey=12345


(Nicolas Bontoux) #2

Hi Durgesh,

Never forget that the scanner-side analysis then triggers a Background Task on the server side. It’s only when that Background Task is processed that results are persisted and available on the server side. Must-read on this topic: https://docs.sonarqube.org/display/SONAR/Background+Tasks !


(Janos Gyerik) #3

In addition to what Nico wrote, the documentation of /api/ce/submit mentions this (emphasis mine):

Submits a scanner report to the queue. Report is processed asynchronously.

So yes, after an analysis is submitted, the report is processed in the background. The REST API returns a response with a taskId in it, which you can use with the /api/ce/task endpoint to check on its status.


(durgesh) #4

Get it simple, so there is latency ryt…if I curl it without delay…is this same with Enterprise edition too???


(Janos Gyerik) #5

@durgesh It’s the same in all editions. There is no sync version of this call, only async.