maproulette-backend icon indicating copy to clipboard operation
maproulette-backend copied to clipboard

add endpoint for fetching task markers specifically

Open CollinBeczak opened this issue 1 year ago • 3 comments

The PUT /tasks/box/:left/:bottom/:right/:top endpoint has some unneeded complexity when fetching for task markers. The reason why that endpoint was so complex is because it is also used to fetch task table data. This led to slower performance when fetching markers because paging, ordering, and sorting was applied.

Because that structure is needed for the tables but not for fetching tasks markers, I have created a new endpoint to reduce complexity: PUT /tasks/markers/:left/:bottom/:right/:top .

This new endpoint exports the same task data as the previous endpoint, but doesn't query for the total task count, and also doesn't do any ordering or paging.

21771 task in view with 1001 task limit: Old endpoint (Time to complete: ~ 1.1s-1.9s ): Screenshot 2024-07-19 at 4 36 15 PM

New endpoint (Time to complete: ~ 400ms-600ms): Screenshot 2024-07-19 at 4 36 33 PM

977 task in view with 1001 task limit: Old endpoint (Time to complete: ~ 450ms-700ms): Screenshot 2024-07-19 at 4 37 34 PM

New endpoint (Time to complete: ~300ms-550ms): Screenshot 2024-07-19 at 4 37 59 PM

Times were recorded on the same device at a similar time, and ran multiple times to get an average. There is a small performance increase with the new endpoint when the number of tasks in view is below the limit. A bigger performance increase is noticeable whenever there are significantly more than 1001 tasks(or the limit) as the endpoint no longer needs to query for all the tasks the meet the filter requirements to get the total tssk count.

CollinBeczak avatar Jun 03 '24 19:06 CollinBeczak

Quality Gate Failed Quality Gate failed

Failed conditions
24.9% Duplication on New Code (required ≤ 3%)

See analysis details on SonarCloud

sonarqubecloud[bot] avatar Jun 03 '24 19:06 sonarqubecloud[bot]

I'll get this rebased

CollinBeczak avatar Sep 03 '24 23:09 CollinBeczak

(Approved in direct conversation)

CollinBeczak avatar Jan 02 '25 16:01 CollinBeczak