-
Notifications
You must be signed in to change notification settings - Fork 14
Conversation
2ca6748
to
b569e5b
Compare
Changes Unknown when pulling b569e5b on wtrocki:RAINCATCH-1126 into ** on feedhenry-raincatcher:master**. |
public stop(): Bluebird<any> { | ||
const self = this; | ||
return new Bluebird(function(resolve, reject) { | ||
syncApi.startSync(self.datasetId, function() { |
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.
this should be stopSync?
private getQueueSize = function() { | ||
const self = this; | ||
return new Bluebird(function(resolve) { | ||
syncApi.getPending(self.datasetId, function(pending?) { |
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.
Whats the ?
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.
short form of pending?:any
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.
pending: any | undefined
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.
Is there a way to handle errors for 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.
Actually I was thinking about this as well and aparently this code is just fetching local data. Errors will just return empty object.
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 thought that might be the case, maybe of an error value like -1 or so.
b569e5b
to
d5a53cf
Compare
Changes Unknown when pulling d5a53cf on wtrocki:RAINCATCH-1126 into ** on feedhenry-raincatcher:master**. |
*/ | ||
public list(callback: (err?: Error, results?: any) => void) { | ||
public list(): Bluebird<any> { |
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 think this could at least be an array type instead of bare any
, helps client code a little.
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.
To be clear - you mean any[]
?
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.
Yes I think that works
resolve(dataSetData); | ||
}, function handleSyncListError(syncErrorCode: string, syncErrorMessage: string) { | ||
reject(new Error(self.formatSyncErrorMessage(syncErrorCode, syncErrorMessage))); | ||
}); |
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.
💯
Bluebird.resolve(); | ||
}, function() { | ||
Bluebird.reject(new Error('forceSync error')); | ||
}); |
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 think this last then
is redundant, and wrong since it's not return
ing anything.
If you're just looking to mask the return value and error value, .then(() => undefined).catch(() => Bluebird.reject(new Error('forceSync error')))
should do the trick.
fa59b10
to
21d84bc
Compare
Changes Unknown when pulling 21d84bc on wtrocki:RAINCATCH-1126 into ** on feedhenry-raincatcher:master**. |
Motivation
Implement forceSync in DataManagers for sync
See: feedhenry-raincatcher/raincatcher-angularjs#64 for mobile changes.