Skip to content

Commit

Permalink
Add retries to the wp theme list command (#142)
Browse files Browse the repository at this point in the history
  • Loading branch information
weiiwang01 authored Oct 13, 2023
1 parent c4b18e3 commit 5b529cd
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
1 change: 1 addition & 0 deletions .github/workflows/integration_test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ jobs:
name: Integration Test (With Secrets)
steps:
- uses: actions/checkout@v4
- run: sudo rm -rf /usr/local/lib/android
- name: Setup Devstack Swift
id: setup-devstack-swift
uses: canonical/setup-devstack-swift@v1
Expand Down
8 changes: 7 additions & 1 deletion src/charm.py
Original file line number Diff line number Diff line change
Expand Up @@ -824,7 +824,13 @@ def _wp_addon_list(self, addon_type: str):
keys: name, status, update and version.
"""
self._check_addon_type(addon_type)
process = self._run_wp_cli(["wp", addon_type, "list", "--format=json"], timeout=600)
# FIXME: the feedwordpress plugin causes the `wp theme list` command to fail occasionally
# use retries as a temporary workaround for this issue
for wait in (1, 3, 5, 5, 5):
process = self._run_wp_cli(["wp", addon_type, "list", "--format=json"], timeout=600)
if process.return_code == 0:
break
time.sleep(wait)
if process.return_code != 0:
return types_.ExecResult(
success=False, result=None, message=f"wp {addon_type} list command failed"
Expand Down

0 comments on commit 5b529cd

Please sign in to comment.