Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added options to disable live sync and support for periodic polling for changes #140

Open
wants to merge 37 commits into
base: master
Choose a base branch
from

Conversation

simonexmachina
Copy link
Collaborator

No description provided.

Stepan Stolyarov and others added 5 commits December 14, 2015 18:26
Unit test courtesy of Matt Marcum @mattmarcum
* upstream/master: (32 commits)
  fixing readme reference to config key, concerning adapter blueprint.
  3.2.1
  Fix(Addon): Call super in init
  3.2.0
  Add relationship documentation
  Update README.md
  update readme
  update readme
  3.1.1
  (pouchdb-community#16) - Add override so serialiser saves hasMany
  Pouch adapter now calls a hook method when encountering a change for a record that is not yet loaded.
  update readme
  3.1.0
  Fix version check for Ember Data 3.2.x
  Update changelog for pouchdb-community#103
  Tests for existing change watcher behavior
  Factor out integration test setup into module helper
  Move blueprint files into explicit directories
  Changelog for pouchdb-community#101 and pouchdb-community#102.
  created blueprint for pouch-adapter
  ...
@simonexmachina simonexmachina changed the title Added option to disable live sync and support for periodic polling for changes Added options to disable live sync and support for periodic polling for changes Sep 14, 2016
broerse and others added 24 commits September 23, 2016 10:01
[skip ci]
- Use Ember.get so that POJOs can be used instead of Ember.Object instances
…lyfill for PhantomJS when running tests.

- Add Ember.run() to taco-salad adapter to avoid exceptions when running tests
@simonexmachina
Copy link
Collaborator Author

@broerse I'd like to get this PR merged, can you please review?

* upstream/master: (31 commits)
  Fix Typo
  4.0.1
  Fix Blueprint
  4.0.0
  Update README
  Updated README and changelog
  changed selector to filter
  implement glue code for query and queryRecord
  Check ember-data version and add install instructions for old ember-data/ember-cli
  Remove ember-data-1.13 from ember-try scenarios. Add Object.assign polyfill for PhantomJS when running tests.
  Tests passing in PhantomJS
  Added integration test
  Ensure that length is available when the attachment is first saved
  Change serializer so that attachments are passed to and from relational-couch correctly
  Update unit test
  Provide two transforms: `attachment` and `attachments`
  Return [] from serialize so that files can be added.
  Documentation for `defaultValue` of `attachment`
  Is fix a typo
  Deserialize "no attachments" into an empty array
  ...
@broerse
Copy link
Collaborator

broerse commented Sep 29, 2016

@aexmachina I understand the need to specify the Change Notifacation type. But I don't think it should be a enable/disable flag. CouchDB has now 3 options, It could be more in the future. I also think this should be handled by pouchdb and from ember-pouch we just pass the option to pouchdb. So I am not sure we should merge this in this form.

@simonexmachina
Copy link
Collaborator Author

I probably should have been clearer about the intent of this PR. The goal is to allow an adapter to use a PouchDB instance that has an HTTP transport without using long polling. Currently, if you provide a PouchDB instance with an HTTP transport (i.e. directly to the remote - without a local) then the adapter's call to db.changes() will use long polling, which is a problem for us because we end up running out of sockets when multiple tabs are opened.

This PR provides two features to solve this:

  1. liveSync: false disables the long polling
  2. syncInterval: 10000 polls for changes every 10 seconds

@broerse
Copy link
Collaborator

broerse commented Sep 30, 2016

@nolanlawson I think it is better to add something like a:

feed=normal
feed=longpoll
feed=continuous
feed=eventsource

option to pouchdb and we set this option in ember-pouch. Perhaps only support normal , longpoll , eventsource for now. What do you think?

@simonexmachina
Copy link
Collaborator Author

@broerse I agree that is a better solution, if @nolanlawson is open to adding support to PouchDB then I can look at doing a PR. Could take me a while to get to it though!

I'm thinking that adding a feed option to the #changes method would be the right way to expose this. Probably deprecating the live: true option and directing people to use feed: 'longpoll' instead.

@broerse
Copy link
Collaborator

broerse commented Oct 3, 2016

feed: and live: are not the same. Live replication (or "continuous" replication) is a separate mode where changes are propagated between the two databases as the changes occur. In other words, normal replication happens once, whereas live replication happens in real time. So this does not need to be deprecated if we introduce feed:

@simonexmachina
Copy link
Collaborator Author

@broerse live: true would be equivalent to feed: 'longpoll'. Remember that in order to move this functionality to PouchDB it does need to be continuous i.e. repeatedly polling for changes or maintaining a long polling, continuous or SSE connection.

@broerse
Copy link
Collaborator

broerse commented Oct 4, 2016

@aexmachina with live: true, feed: 'longpoll' is "continuous" replication. With live: false , feed: 'longpoll' replication happens once. Also with live: true, feed: 'normal' is "continuous" replication. With live: false , feed: 'normal' replication happens once. So we don't agree on that this is equivalent.

@simonexmachina
Copy link
Collaborator Author

Thanks for clarifying that @broerse, now I understand better. The feed option doesn't seem to be documented anywhere. It seems to me that the options interface could be better because live: false doesn't really make sense with any feed type other than normal. Hence my suggestion that live be replaced with feed. Anyway, I'm happy to take whatever guidance you or @nolanlawson want to offer.

On that note, @nolanlawson doesn't seem to be replying. Is there someone else I should be speaking to about this?

@broerse
Copy link
Collaborator

broerse commented Oct 5, 2016

@aexmachina Perhaps you should open an issue on pouchdb asking for feed: 'longpoll' and feed: 'normal' support.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants