Skip to content

Instantly share code, notes, and snippets.

@borispoehland
Created August 27, 2023 14:30
Show Gist options
  • Save borispoehland/8879ac329c9237176302d6f94b08da84 to your computer and use it in GitHub Desktop.
Save borispoehland/8879ac329c9237176302d6f94b08da84 to your computer and use it in GitHub Desktop.
Test
Effect.flatMap(({ id }) => {
const program = fetchFresh(
pollSchema,
`https://graph.facebook.com/${id}${objectToQueryString({
fields: 'status_code',
access_token: FACEBOOK_PAGE_TOKEN,
})}`
)
return Effect.repeatUntilEffect(program, (props) => {
const { status_code } = props
if (status_code === 'FINISHED') {
return Effect.succeed(true)
}
return pipe(
Effect.succeed(false),
Effect.tap(() => Effect.logInfo(JSON.stringify(props))),
Effect.delay('10 seconds')
)
})
}),
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment