1
0
mirror of https://github.com/netbox-community/netbox.git synced 2024-05-10 07:54:54 +00:00

fixes #3428 - caching invalidation issues

Mitgate invalidation issues by using prefetch_related instead of select_related.
Also use invalidated_update instead of just update.
This commit is contained in:
John Anderson
2019-08-19 01:53:39 -04:00
parent dd4dafa7be
commit ade844f7a7
29 changed files with 236 additions and 294 deletions

View File

@ -3430,11 +3430,11 @@ class VirtualChassisTest(APITestCase):
# Create two VirtualChassis with three members each
self.vc1 = VirtualChassis.objects.create(master=self.device1, domain='test-domain-1')
Device.objects.filter(pk=self.device2.pk).update(virtual_chassis=self.vc1, vc_position=2)
Device.objects.filter(pk=self.device3.pk).update(virtual_chassis=self.vc1, vc_position=3)
Device.objects.filter(pk=self.device2.pk).invalidated_update(virtual_chassis=self.vc1, vc_position=2)
Device.objects.filter(pk=self.device3.pk).invalidated_update(virtual_chassis=self.vc1, vc_position=3)
self.vc2 = VirtualChassis.objects.create(master=self.device4, domain='test-domain-2')
Device.objects.filter(pk=self.device5.pk).update(virtual_chassis=self.vc2, vc_position=2)
Device.objects.filter(pk=self.device6.pk).update(virtual_chassis=self.vc2, vc_position=3)
Device.objects.filter(pk=self.device5.pk).invalidated_update(virtual_chassis=self.vc2, vc_position=2)
Device.objects.filter(pk=self.device6.pk).invalidated_update(virtual_chassis=self.vc2, vc_position=3)
def test_get_virtualchassis(self):