So Google Calendar's API might return duplicate events when using nextPageToken in your requests and they don't tell you that. So I've been trying to find where the fuck my app was inserting duplicate data in the DB but it turns out it wasn't, it's just the Calendar API being a dick. Aaaaaa

  • 4
    Always add code to handle idempotency checks when dealing with event streams.
  • 0
    @SortOfTested yeah I just learned that.... But now I'm taking a huge performance hit. Checking for duplicates is O(n^2), or am I missing something?
  • 2
    Depends on what defines your algebraic identity. You can implement distinct in O(n) time and O(m) space using memoization via an O(n) insertion O(1) lookup hash in many cases.
  • 0
    @SortOfTested nice, I'll look into it. Thank you!
Add Comment