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

bugfix, dont call with too many items #292

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 9 additions & 9 deletions arxiv/integration/fastly/purge.py
Original file line number Diff line number Diff line change
Expand Up @@ -143,13 +143,13 @@ def _purge_multiple_keys(keys: List[str], service_id:str, api_instance: PurgeApi
if len(keys)> MAX_PURGE_KEYS:
_purge_multiple_keys(keys[0:MAX_PURGE_KEYS], service_id, api_instance, soft_purge)
_purge_multiple_keys(keys[MAX_PURGE_KEYS:], service_id, api_instance,soft_purge)

options = {
'service_id': service_id,
'purge_response': {'surrogate_keys':keys,}
}
if soft_purge:
options['fastly_soft_purge']=1
api_response=api_instance.bulk_purge_tag(**options)
logger.debug(f"Bulk purge keys response: {api_response}")
else:
options = {
'service_id': service_id,
'purge_response': {'surrogate_keys':keys,}
}
if soft_purge:
options['fastly_soft_purge']=1
api_response=api_instance.bulk_purge_tag(**options)
logger.debug(f"Bulk purge keys response: {api_response}")
return
1 change: 1 addition & 0 deletions arxiv/integration/tests/test_fastly.py
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,7 @@ def test_purge_over_max_keys(self, MockApiClient, MockPurgeApi: PurgeApi):
]

mock_api_instance.bulk_purge_tag.assert_has_calls(calls, any_order=True)
self.assertEqual(mock_api_instance.bulk_purge_tag.call_count, len(calls))


#tests for adding surrogate keys helper function
Expand Down
Loading