I have a large amount, here being about 100,000 or more records, of a particular type of model in the ember store that I created by passing a JSON object to the store's createRecord
method. When i try and unload all of these records using store.unloadAll('record-type')
the records do eventually all end up being fully unloaded from the store, but it takes about 90 seconds for the operation to complete.
What confuses me more is that the unloadAll
method returns instantly and does not return a promise yet the web GUI will freeze up, and, using the ember inspector I can see all of the records are still present, until after about 90 seconds when they finally disappear.
I am calling the unloadAll
method from an action as below:
actions: {
unloadStore() {
console.log('calling unloadAll');
this.get('store').unloadAll('record-type');
console.log('unloadAll returns immediately');
}
}
And I am creating these models as below:
for(let obj of data.response){
store.createRecord('record-type', {
'id': obj._id.$oid,
'prop1': obj.prop1,
'prop2': obj.prop2,
'prop3': obj.prop3
});
}
Is it expected that unloading this amount of records should take 80+ seconds or am I doing something wrong? I have noticed through Chrome's performance profiler that a large amount of time is spent in the removeObject
method of the ember.debug.js file. And I think it has something to do with the repeated firings of the arrayContentWillChange and other such events triggered by changing the record array during unloadAll
's execution. A screenshot of the performance profile is linked here .
Aucun commentaire:
Enregistrer un commentaire