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

Template cache policy for failed browser automation #118

Open
fgregg opened this issue Aug 7, 2023 · 1 comment · May be fixed by #157
Open

Template cache policy for failed browser automation #118

fgregg opened this issue Aug 7, 2023 · 1 comment · May be fixed by #157

Comments

@fgregg
Copy link

fgregg commented Aug 7, 2023

it would be good to either add as a default cache policy, or provide as documentation a cache policy that will fail on any failed automations

class ZyteAPIPolicy(DummyPolicy):

    def should_cache_response(self, response, request):
        if not super().should_cache_response(response, request):
            return False

        if any('error' in action for action in response.raw_api_response['actions']):
            return False

        return True
@Gallaecio
Copy link
Contributor

I don’t think it should be default, but certainly worth documenting. If it gets popular enough, it maybe be even worth allowing to enable it though a setting.

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

Successfully merging a pull request may close this issue.

2 participants