Skip to content

Commit 90f6b7b

Browse files
committed
Add download duration and error reporting to Pushy class
1 parent 8287408 commit 90f6b7b

File tree

1 file changed

+11
-1
lines changed

1 file changed

+11
-1
lines changed

src/client.ts

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -353,6 +353,7 @@ export class Pushy {
353353
if (Pushy.progressHandlers[hash]) {
354354
return;
355355
}
356+
const patchStartTime = Date.now();
356357
if (onDownloadProgress) {
357358
// @ts-expect-error harmony not in existing platforms
358359
if (Platform.OS === 'harmony') {
@@ -458,9 +459,18 @@ export class Pushy {
458459
}
459460
return;
460461
} else {
462+
const duration = Date.now() - patchStartTime;
463+
const data: Record<string, any> = {
464+
newVersion: hash,
465+
diff: succeeded,
466+
duration,
467+
};
468+
if (errorMessages.length > 0) {
469+
data.error = errorMessages.join(';');
470+
}
461471
this.report({
462472
type: 'downloadSuccess',
463-
data: { newVersion: hash, diff: succeeded },
473+
data,
464474
});
465475
}
466476
log(`downloaded ${succeeded} hash:`, hash);

0 commit comments

Comments
 (0)