Skip to content
This repository has been archived by the owner on Apr 17, 2023. It is now read-only.

[RAINCATCH-623] Use fh-sync clearCache on logout #120

Merged
merged 2 commits into from Sep 18, 2017

Conversation

JameelB
Copy link
Contributor

@JameelB JameelB commented Sep 14, 2017

Motivation

In the mobile app, the previous logged in user's data is shown upon login. We need to clear sync cache to prevent this.

Description

Utilize fh-sync's clearCache function to allow cache to be cleared upon logout.

Progress

  • Add clearCache functionality that uses fh-syncs clearCache

Additional Notes

Related JIRA - https://issues.jboss.org/browse/RAINCATCH-623

wtrocki
wtrocki previously approved these changes Sep 14, 2017
Copy link
Member

@wtrocki wtrocki left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Minor comments

@@ -138,9 +138,9 @@ export class DataManager {
const self = this;
return new Bluebird(function(resolve, reject) {
syncApi.stopSync(self.datasetId, function() {
resolve();
return resolve();
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Btw.. thats optional and has no effect.

@@ -179,8 +179,7 @@ export class DataManager {
const options = _.defaults(userOptions, defaultOptions);
function forceSyncThenStop(pendingUpdateQueueSize) {
if (pendingUpdateQueueSize === 0) {
self.stop().then(Bluebird.resolve);
return;
return self.stop().then(Bluebird.resolve);
}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I know its not your change but worth improving: then is not needed

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

btw the cleanest way to wrap a promise in a bluebird one is return Bluebird.resolve(promisefn())

* Clears the cache for the dataset
*/
public clearCache() {
const self = this;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

self not needed

@coveralls
Copy link

coveralls commented Sep 15, 2017

Coverage Status

Changes Unknown when pulling 51d52ea on JameelB:RAINCATCH-623 into ** on feedhenry-raincatcher:master**.

Copy link
Member

@wtrocki wtrocki left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewed, Verified.

@JameelB JameelB merged commit 3082354 into feedhenry-raincatcher:master Sep 18, 2017
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants