Parse.com的文件指针保存速度慢 [英] Parse.com save slow with pointers to files

查看:88
本文介绍了Parse.com的文件指针保存速度慢的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个名为Photo的Parse.Files类,用于处理不同大小的照片和一堆照片元数据.一切正常,直到我尝试更新完全填充的Photo对象上的非File字段之一.如果我尝试更新非文件字段之一,但所有文件字段(原始照片,调整大小的照片和缩略图)都已填充,则更新元数据的字符串字段之一需要花费3秒钟以上的时间!

I have a class called Photo with Parse.Files for different sizes of the photo and a bunch of photo metadata. Everything is working fine until I try to update one of the non-File fields on a fully populated Photo object. If I try to update one of the non-file fields but all of the File fields (Original photo, Resized photo, and thumbnail) are populated, then it takes >3 seconds to do an update of one of the String fields of metadata!

我已经检查了保存性能与我拥有的所有其他类的比较情况,它们均按预期的速度(小于1秒)进行了更新.为什么似乎要检查文件二进制文件是否脏(或者在保存过程中在Parse服务器上可能进行的其他操作),以使保存操作花费这么长时间?

I have checked save performance against every other class I have and they all update as quickly as expected (<1 second). Why would it seem to be checking the File binaries if they are dirty (Or whatever else it might be doing on the Parse server during the save) to make the save operation take so long?

以下是在Chrome网络浏览器中保存的照片对象的性能图片:

Here is an image of the performance of a Photo Object save in Chrome network browser:

这是一个保存具有原始数据类型(无文件)的类对象的示例:

And this is an example of a save for an object of class that just has primitive data types (no files):

任何人都对正在发生的事情或如何解决这个问题有任何见解?仅更新一个Parse对象上的String字段需要3秒!

Anyone have any insights about what is going on or how I can get around this? 3 seconds is way too long just to update a String field on a Parse Object!

推荐答案

我能够确定这实际上是我的此类的AfterSave处理程序,不需要进行其他工作.

I was able to determine that this was actually my afterSave handler for this class doing unnecessary work.

它仅应在最初的对象创建时运行,但每次都运行,有时甚至以递归的方式运行.添加了一些逻辑来实现所需的行为,并且一切看起来都按预期进行.

It was only supposed to be running at initial object creation, but was running every time and sometimes even in a recursive way. Added some logic to achieve the desired behavior and everything looks to be working as expected.

值得注意的一点是,在afterSave云模块完全完成运行之后,对save()的HTTP请求似乎不会返回.直到经过全面测试,我才知道这一点.

A good point to note is that it looks like the HTTP request for save() will not return until after the afterSave cloud module has completely finished running. This wasn't clear to me until after thorough testing.

这篇关于Parse.com的文件指针保存速度慢的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆