-
Notifications
You must be signed in to change notification settings - Fork 141
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
Feature/retry insights job polling #174
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this might need a bit of a redesign to get a proper retry pattern set up.
tap_facebook/__init__.py
Outdated
def api_get_with_retry(job): | ||
job = job.api_get() | ||
return job | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'd move this closer to usage inside the class and mark it "private" in the python sense by prefixing with __
.
Pylint will probably warn about no self usage, but I think you can use @staticmethod
to stop that. So like:
@staticmethod
@retry_pattern(backoff.constant, FacebookRequestError, max_tries=5, interval=1)
def __api_get_with_retry(job):
job = job.api_get()
return job
Then the usage would be
AdsInsights.__api_get_with_retry(job)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The benefit of this is that it makes it clear that this is only for insights usage and to keep it localized for if we want to refactor the class into its own module.
* Add sleep and retry for insights job polling * correct dylans typo * added tests, got tests passing * Makes api_get_with_retry function that uses retry wrapper * Style changes * Style changes 2 * Version Bump * removed count
Description of change
Adds sleep and retry to job polling. Creates new tests for consistent failure / retry and failure / eventual success.
Manual QA steps
Risks
Rollback steps