lundi 7 mars 2016

How to make bulk save in Ember Pouch

I want to know if there is a way to save a lot of records in pouchDB locally at once. I'm downloading, lets say a hundred records from remote server, and I want to save them locally but it's very slow. Inspecting with Ember Inspector and enabled debug mode of the pouchdb I see that the records are not being saved at once, but one after another and it takes more than 100ms for each record(screenshot). I use pouchDB only locally with Ember 2.2. I tried to set the bulkCommit property to true, but it doesn't help. This is how my ember adapter looks like:

 import PouchDB from 'pouchdb';
 import { Adapter } from 'ember-pouch';
 import Ember from 'ember';

 let db = new PouchDB("DB-local", {adapter: 'websql', auto_compaction: true, bulkCommit: true});

 export default Adapter.extend({
     db: db,
     shouldReloadRecord: function() { return true; },
     shouldReloadAll: function() { return true; },
 });

Forgot to say that I'm building a mobile app, using ember-cli-cordova 0.0.17.




1 commentaire:

  1. Your post had been a pretty old but I just have the same problem and tried with almost the same code snippet. Did you solve the problem? Seems that I can't give arguments with the constructor of a new PouchDB.

    RépondreSupprimer