Skip to content

Commit

Permalink
clean cache during data restore (#2563)
Browse files Browse the repository at this point in the history
and fix failing parser test
  • Loading branch information
petrjasek committed May 17, 2024
1 parent 9e50716 commit a7691c1
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 0 deletions.
2 changes: 2 additions & 0 deletions superdesk/commands/data_manipulation.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@
from superdesk.timer import timer
from superdesk.resource import Resource
from superdesk.services import BaseService
from superdesk.cache import cache
from . import data_updates, flush_elastic_index


Expand Down Expand Up @@ -488,6 +489,7 @@ def run(self, dump_path: Union[Path, str], keep_existing: bool = False, no_flush
except Exception:
logger.exception("😭 Something went wrong")
sys.exit(1)
cache.clean()
print("🏁 All done")

def restore_file(self, archive_path: Path):
Expand Down
4 changes: 4 additions & 0 deletions tests/io/feed_parsers/wordpress_wxr_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -83,9 +83,13 @@ def fake_update_renditions(item, url, _):


class WPWXRTestBase(TestCase):
filename = None

@mock.patch.object(wordpress_wxr, "update_renditions", fake_update_renditions)
def __init__(self, methodname):
super().__init__(methodname)
if self.filename is None:
return
dirname = os.path.dirname(os.path.realpath(__file__))
fixture = os.path.normpath(os.path.join(dirname, "../fixtures", self.filename))
provider = {"name": "Test"}
Expand Down

0 comments on commit a7691c1

Please sign in to comment.