Skip to content

Instantly share code, notes, and snippets.

marekbrzoska / Defering Django fields
Created July 17, 2012 07:54
A try of library for defering field in Django. This version is prepared with relationship (FK, ManyToMany etc) in mind. Inpired by
View Defering Django fields
from django.db import models
class DeferedField(object):
def __init__(self, cls, **kwargs):
'''When defining defered field, we declare it's type and properties'''
self.cls = cls
self.kwargs = kwargs
def construct(self, model_alias, **kwargs):
View gist:6146639
#Setup the rate control and delay
sudo tc qdisc add dev lo root handle 1: htb default 12
sudo tc class add dev lo parent 1:1 classid 1:12 htb rate 56kbps ceil 128kbps
sudo tc qdisc add dev lo parent 1:12 netem delay 200ms
#Remove the rate control/delay
sudo tc qdisc del dev lo root