You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
import{RetryError}from'@posthog/plugin-scaffold'// also a globalexportasyncfunctionexportEvents(events,{ global, config }){try{awaitfetch(`https://${config.host}/e`,{method: 'POST',body: JSON.stringify(events),headers: {'Content-Type': 'application/json'},})}catch(error){thrownewRetryError()// ask to retry}}
This exportEvents function will now be automatically retried.
We should add the same functionality to onEvent, onSnapshot, and in the future perhaps also processEvent, though that's a bit trickier due to the ordering requirements.
Retries should also be something that's easy to add or automatic in other new functions like onAction, onRequest (incoming webhooks), etc.
The text was updated successfully, but these errors were encountered:
One complication introduced by PostHog/plugin-server#408 is that the buffer.add call to enqueue events that eventually reach exportEvents is done in a patched onEvent. Basically:
This messes up the retry logic a bit and should be split up nicely (as in don't retry the export when retrying the regular onEvent... it has its own retry handling).
This issue hasn't seen activity in two years! If you want to keep it open, post a comment or remove the stale label – otherwise this will be closed in two weeks.
PR PostHog/plugin-server#408 introduced
RetryError
, which you use like this:This
exportEvents
function will now be automatically retried.We should add the same functionality to
onEvent
,onSnapshot
, and in the future perhaps alsoprocessEvent
, though that's a bit trickier due to the ordering requirements.Retries should also be something that's easy to add or automatic in other new functions like
onAction
,onRequest
(incoming webhooks), etc.The text was updated successfully, but these errors were encountered: