Idempotency & Duplicate Prevention
How BuddyActivity ensures each activity is created exactly once, even if a sync runs multiple times.
Idempotency means that running the same operation multiple times produces the same result as running it once. In BuddyActivity's context, this means a row in your Google Sheet will only ever create one BuddyBoss activity — even if the row is read by multiple syncs.
How It Works
BuddyActivity uses a two-layer approach to prevent duplicates:
1. Row ID Tracking
When BuddyActivity processes a row, it records the row's id in its internal database. Before processing any row, it checks whether that ID has already been processed. If it has, the row is skipped.
2. Status Column Update
After a row is processed, BuddyActivity writes done to the status column in your sheet. Rows with a done status are always skipped, providing a visible audit trail directly in the spreadsheet.
When Duplicates Can Occur
Despite these safeguards, duplicates can occur in rare edge cases:
- Duplicate row IDs — If two rows in your sheet share the same
id, only the first row processed will be protected. The second row with the same ID will be skipped, potentially leaving an activity uncreated. - Sheet position reset — If you reset the sheet position manually, BuddyActivity will re-read rows from the top. Rows that were already processed will be skipped due to ID tracking, but any edge case where the ID database was cleared could cause reprocessing.
- Simultaneous syncs — If two sync processes start at the exact same millisecond (very rare on standard hosting), a race condition could theoretically allow a row to be processed twice before either process marks it done.
id values in your sheet. This is the single most important practice for maintaining idempotency.Best Practices
- Use sequential numeric IDs (1, 2, 3...) or a timestamp-based scheme to guarantee uniqueness.
- Never manually edit or clear the
statuscolumn on processed rows. - Never delete processed rows from the sheet — leaving them with their
donestatus intact provides both a record and duplicate protection. - If you need to republish a specific activity, add it as a new row with a new unique ID instead of resetting the old row's status.