Skip to content

Commit

Permalink
Return proper empty data object if CareLink has stale data
Browse files Browse the repository at this point in the history
  • Loading branch information
mddub committed Jan 7, 2016
1 parent 490427f commit 0c267f6
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion transform.js
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,10 @@ module.exports = function(data, sgvLimit) {
var recency = (data['currentServerTime'] - data['lastMedicalDeviceDataUpdateServerTime']) / (60 * 1000);
if (recency > STALE_DATA_THRESHOLD_MINUTES) {
logger.log('Stale CareLink data: ' + recency.toFixed(2) + ' minutes old');
return [];
return {
devicestatus: [],
entries: [],
};
}

if (sgvLimit === undefined) {
Expand Down

0 comments on commit 0c267f6

Please sign in to comment.