Paginate the notes incremental fetch endpoint
Returning an unlimited number of elements from any endpoint is a bad idea. For the notes endpoint specifically, we return all notes since a given `X-Last-Fetched-At` value. The backend specifies the new value to use for that item in the response, so if we return a limited set of notes and use an appropriate value, we get a rudimentary form of keyset pagination for free. The way the notes endpoint is used today, this is mostly a theoretical worry, and in practice, basically every response will fit within a single page anyway. However, we can use the `notes` endpoint *instead of* the `discussions` endpoint to fill a merge request discussion from the beginning of time. When we do this, large discussions are loaded in batches automatically, using pre-existing frontend code. So this change is best seen as preparatory work for removing `discussions` altogether. This commit also fixes a pre-existing problem with the endpoint, which is the fact that `updated_at` is stored with *microsecond* precision in the database. Converting the X-Last-Fetched-At value from integer to float allows us to avoid a range of boundary conditions that result.
Showing
Please register or sign in to comment