add batching for measurement backfill.
This commit is contained in:
+3
-1
@@ -184,7 +184,9 @@ module.exports = function workoutRouter(repo) {
|
||||
}
|
||||
|
||||
workout.listMeasurements().then((list) => {
|
||||
ws.send(JSON.stringify({workoutStatusBackfill: list}));
|
||||
for (let i = 0; i < list.length; i += 240) {
|
||||
ws.send(JSON.stringify({workoutStatusBackfill: list.slice(i, i+240)}));
|
||||
}
|
||||
}).catch(err => {
|
||||
ws.send(JSON.stringify({error: `could not list measurements: ${err.message || err}`}));
|
||||
ws.close();
|
||||
|
||||
Reference in New Issue
Block a user