PagerDuty / go-pagerduty

go client library for PagerDuty v2 API
https://v2.developer.pagerduty.com/docs/rest-api
Apache License 2.0
285 stars 241 forks source link

Duplicate incidents returned when ListIncidentsOptions.Statuses includes multiple items with resolved, and > 25 #496

Open GavinB-hpe opened 12 months ago

GavinB-hpe commented 12 months ago

I have some code that pulls a list of incidents from the API. The code includes setting the ListIncidentsOptions.Statuses field with the statuses I want. What I have observed is that once the number of incidents returned is greater than 25, irrespective of the number fetched per call (I am using pagination, and have experimented with various values for Limit), I start to get duplicates returned. Not everything returned is a duplicate, but it can be the vast majority depending on the exact settings used.

Investigating, I found that the issue is in some way related to use of the "resolved" value. If I set the Statuses option with a range of values including "resolved", I get duplicates. If I have only "triggered" and "acknowledged" all is well. If I have an array with a single value and use "resolved", all is well.

The number of items returned feels correct - however the content is not (I am checking the incident_number and/or ID for uniqueness)

My current workaround is to loop over the statuses I want, and fetch incidents for each one independently, then append. That works as expected.

I have experimented with curl and attempted to duplicate this, but did not manage to do so. curl seems to work fine. Seems to be something in the go code.