Skip to content
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
3 changes: 3 additions & 0 deletions contentcuration/contentcuration/tests/utils/test_nodes.py
Original file line number Diff line number Diff line change
Expand Up @@ -92,12 +92,14 @@ def test_missing__too_big__forced(self, cache, helper):
self.node.get_descendant_count.return_value = STALE_MAX_CALCULATION_SIZE + 1
self.assertCalculation(cache, helper, force=True)

@mock.patch("contentcuration.utils.nodes.STALE_MAX_CALCULATION_SIZE", 5000)
def test_missing__small(self, cache, helper):
self.node.get_descendant_count.return_value = 1
cache().get_size.return_value = None
cache().get_modified.return_value = None
self.assertCalculation(cache, helper)

@mock.patch("contentcuration.utils.nodes.STALE_MAX_CALCULATION_SIZE", 5000)
def test_unforced__took_too_long(self, cache, helper):
self.node.get_descendant_count.return_value = 1
cache().get_size.return_value = None
Expand All @@ -115,6 +117,7 @@ def db_get_size():
self.assertIsInstance(report_exception.mock_calls[0][1][0], SlowCalculationError)


@mock.patch("contentcuration.utils.nodes.STALE_MAX_CALCULATION_SIZE", 5000)
class CalculateResourceSizeIntegrationTestCase(BaseTestCase):
"""
Integration test case
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

import uuid

import mock
import pytest
from django.conf import settings
from django.core.management import call_command
Expand Down Expand Up @@ -1531,6 +1532,7 @@ def test_delete_orphanage_root(self):
except models.ContentNode.DoesNotExist:
self.fail("Orphanage root was deleted")

@mock.patch("contentcuration.utils.nodes.STALE_MAX_CALCULATION_SIZE", 5000)
def test_resource_size(self):
user = testdata.user()
channel = testdata.channel()
Expand Down
3 changes: 2 additions & 1 deletion contentcuration/contentcuration/utils/nodes.py
Original file line number Diff line number Diff line change
Expand Up @@ -353,7 +353,8 @@ def modified_since(self, compare_datetime):
# return result['modified_since']


STALE_MAX_CALCULATION_SIZE = 5000
# TODO: clean up sync vs async calculation switching
STALE_MAX_CALCULATION_SIZE = 0
SLOW_UNFORCED_CALC_THRESHOLD = 5


Expand Down