[RAINCATCH-623] Use fh-sync clearCache on logout #120
Conversation
There was a problem hiding this 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(); |
There was a problem hiding this comment.
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); | |||
} |
There was a problem hiding this comment.
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
There was a problem hiding this comment.
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; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
self not needed
Changes Unknown when pulling 51d52ea on JameelB:RAINCATCH-623 into ** on feedhenry-raincatcher:master**. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Reviewed, Verified.
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
Additional Notes
Related JIRA - https://issues.jboss.org/browse/RAINCATCH-623