Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Triggers are skipped when there are a large number of events #3

Open
tim-mccurrach opened this issue Jan 24, 2022 · 1 comment
Open

Comments

@tim-mccurrach
Copy link

The problem(s)

Events (objects) are returned in descending order of id, which has two consequences:

  1. In most cases this will mean the most recent event/created object results in the first trigger/action. I think for most cases users will want to start with the oldest item.
  2. If my page_size is set to 25, and 30 items are created since my endpoint is last polled, as things stand:
    • the final 25 are forwarded on to Zapier
    • The latest object-id is updated
    • The first 5 objects don't trigger any actions and are lost forever

A proposed solution

  • Order the payload returned to Zapier in ascending order
  • A problem with this approach is that if you already have a large number of objects, you obviously don't want to have to iterate through all of them. Therefore:
  • If no latest-object-id exists, return just the last object and update the latest object id for that scope. (This will work well, since each time a uses a trigger for the first time Zapier will prompt them to try a 'test' poll. Doing this test poll, will update the object-id, and set them up ready to receive subsequent events.)
@hugorodgerbrown
Copy link
Collaborator

The "reverse chronological order" is actually part of the Zapier trigger spec:

To make a standard trigger, use an API endpoint that lists new items in an array sorted in reverse chronological order. These are typically the most common API endpoints to read data from a platform. If your API lists items in a different order by default but allows for sorting, include an order or sorting field in your API call.

https://platform.zapier.com/docs/triggers

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants