我在应用程序中看到了一些平常的事情。没有理由,当我的流量很少或没有时,我的服务器会变慢。经过大量的反复试验,我发现我的问题在我的TastyPie资源上删除了ToOneField
后消失了!如何停止TastyPie无缘无故地进行UPDATE查询?
我发现是因为某些未知原因TastyPie正在做数据库更新对这些ToOneFields没有很好的理由!什么......时刻!
我发现提起here一个可能的错误,声称已经解决了这一问题的更新。我已经安装了从pip
的最新版本,但仍然看到此问题。
任何人都可以帮忙吗?
class IncentiveResource(ModelResource):
product_introducer = fields.ToOneField(ProductResource, 'referrer_product', full=True)
product_friend = fields.ToOneField(ProductResource, 'referee_product', full=True)
class Meta:
queryset = Incentive.objects.all().order_by('-date_created')
resource_name = 'incentive'
allowed_methods = ['get']
authentication = MultiAuthentication(ClientAuthentication(), ApiKeyAuthentication())
authorization = Authorization()
filtering = {
"active": ALL,
}
always_return_data = True
cache = SimpleCache(cache_name='resources', timeout=10)
这里流量很少,但变得无法使用。
上面显示的性能分析输出......使用什么工具? – 8one6
@ 8one6这是新的文物 – Prometheus