Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Comparing changes

Choose two branches to see what's changed or to start a new pull request. If you need to, you can also compare across forks.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also compare across forks.
base fork: mozilla/kuma
...
head fork: mozilla/kuma
Checking mergeability… Don't worry, you can still create the pull request.
  • 2 commits
  • 2 files changed
  • 0 commit comments
  • 1 contributor
Commits on May 17, 2013
@lmorchard lmorchard bug 873327: Waffle flag to enable/disable deferred wiki rendering via…
… celery
aac4eb5
@lmorchard lmorchard Merge pull request #1097 from lmorchard/873327-waffle-switch-for-defe…
…rred-rendering

bug 873327: Waffle flag to enable/disable deferred wiki rendering via celery
78dd7e3
Showing with 18 additions and 1 deletion.
  1. +2 −1  apps/wiki/models.py
  2. +16 −0 apps/wiki/tests/test_models.py
View
3  apps/wiki/models.py
@@ -758,7 +758,8 @@ def schedule_rendering(self, cache_control=None, base_url=None):
Document.objects.filter(pk=self.pk).update(render_scheduled_at=now)
self.render_scheduled_at = now
- if not self.defer_rendering:
+ if (waffle.switch_is_active('wiki_force_immediate_rendering') or
+ not self.defer_rendering):
# Attempt an immediate rendering.
self.render(cache_control, base_url)
else:
View
16 apps/wiki/tests/test_models.py
@@ -1203,15 +1203,31 @@ def test_deferred_vs_immediate_rendering(self, mock_render_document_delay,
mock_kumascript_get):
mock_kumascript_get.return_value = (self.rendered_content, None)
+ switch = Switch.objects.create(name='wiki_force_immediate_rendering')
+
# When defer_rendering == False, the rendering should be immediate.
+ switch.active = False
+ switch.save()
self.d1.rendered_html = ''
self.d1.defer_rendering = False
self.d1.save()
result_rendered, _ = self.d1.get_rendered(None, 'http://testserver/')
ok_(not mock_render_document_delay.called)
+ # When defer_rendering == True but the waffle switch forces immediate,
+ # the rendering should be immediate.
+ switch.active = True
+ switch.save()
+ self.d1.rendered_html = ''
+ self.d1.defer_rendering = True
+ self.d1.save()
+ result_rendered, _ = self.d1.get_rendered(None, 'http://testserver/')
+ ok_(not mock_render_document_delay.called)
+
# When defer_rendering == True, the rendering should be deferred and an
# exception raised if the content is blank.
+ switch.active = False
+ switch.save()
self.d1.rendered_html = ''
self.d1.defer_rendering = True
self.d1.save()

No commit comments for this range

Something went wrong with that request. Please try again.