feat: print message directing users to github issue if windows download takes too long (#2588)
This commit is contained in:
@@ -1,7 +1,9 @@
|
||||
import 'dart:async';
|
||||
import 'dart:io';
|
||||
|
||||
import 'package:crypto/crypto.dart';
|
||||
import 'package:io/io.dart';
|
||||
import 'package:mason_logger/mason_logger.dart';
|
||||
import 'package:path/path.dart' as p;
|
||||
import 'package:shorebird_cli/src/archive_analysis/android_archive_differ.dart';
|
||||
import 'package:shorebird_cli/src/artifact_builder.dart';
|
||||
@@ -118,6 +120,7 @@ Looked in:
|
||||
required String appId,
|
||||
required int releaseId,
|
||||
required File releaseArtifact,
|
||||
Duration downloadMessageTimeout = const Duration(minutes: 1),
|
||||
}) async {
|
||||
final releaseArtifacts = await codePushClientWrapper.getReleaseArtifacts(
|
||||
appId: appId,
|
||||
@@ -128,6 +131,24 @@ Looked in:
|
||||
final releaseArtifactPaths = <Arch, String>{};
|
||||
final numArtifacts = releaseArtifacts.length;
|
||||
|
||||
// Direct users to https://github.com/shorebirdtech/shorebird/issues/2532
|
||||
// until we can provide a better solution.
|
||||
var artifactsDownloadCompleted = false;
|
||||
unawaited(
|
||||
Future<void>.delayed(downloadMessageTimeout).then(
|
||||
(_) {
|
||||
if (artifactsDownloadCompleted) {
|
||||
return;
|
||||
}
|
||||
logger.info(
|
||||
'''
|
||||
It seems like your download is taking longer than expected. If you are on Windows, this is a known issue.
|
||||
Please refer to ${link(uri: Uri.parse('https://github.com/shorebirdtech/shorebird/issues/2532'))} for potential workarounds.''',
|
||||
);
|
||||
},
|
||||
),
|
||||
);
|
||||
|
||||
for (final (i, releaseArtifact) in releaseArtifacts.entries.indexed) {
|
||||
try {
|
||||
final releaseArtifactFile =
|
||||
@@ -141,6 +162,8 @@ Looked in:
|
||||
}
|
||||
}
|
||||
|
||||
artifactsDownloadCompleted = true;
|
||||
|
||||
final patchArchsBuildDir = ArtifactManager.androidArchsDirectory(
|
||||
projectRoot: projectRoot,
|
||||
flavor: flavor,
|
||||
|
||||
@@ -605,6 +605,40 @@ Looked in:
|
||||
expect(signatures, equals(expectedSignatures));
|
||||
});
|
||||
});
|
||||
|
||||
group('when artifacts download takes longer than provided timeout', () {
|
||||
setUp(() {
|
||||
when(
|
||||
() => artifactManager.downloadWithProgressUpdates(
|
||||
any(),
|
||||
message: any(named: 'message'),
|
||||
),
|
||||
).thenAnswer((_) async {
|
||||
await Future<void>.delayed(const Duration(milliseconds: 100));
|
||||
return File('');
|
||||
});
|
||||
});
|
||||
|
||||
test('prints message directing users to github issue', () async {
|
||||
await runWithOverrides(
|
||||
() => patcher.createPatchArtifacts(
|
||||
appId: 'appId',
|
||||
releaseId: 0,
|
||||
releaseArtifact: File('release.aab'),
|
||||
downloadMessageTimeout: const Duration(milliseconds: 50),
|
||||
),
|
||||
);
|
||||
|
||||
verify(
|
||||
() => logger.info(
|
||||
any(
|
||||
that: contains(
|
||||
'https://github.com/shorebirdtech/shorebird/issues/2532'),
|
||||
),
|
||||
),
|
||||
).called(1);
|
||||
});
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
Reference in New Issue
Block a user