tailBuild static method
Stream<AppBuildDetail>
tailBuild(
- Client cloudApiClient, {
- required String projectId,
- required UuidValue buildId,
Returns the app build buildId of project projectId on every change,
until it reaches a final status.
The stream reconnects when the connection drops, or when it closes before the build has ended, and emits a FailureException if it cannot reconnect. It closes before the build has ended only when several connections in a row close without reporting the build.
Implementation
static Stream<AppBuildDetail> tailBuild(
Client cloudApiClient, {
required String projectId,
required UuidValue buildId,
}) async* {
AppBuildDetail? lastDetail;
var silentTails = 0;
while (true) {
var reported = false;
await for (final detail in _tailBuildConnection(
cloudApiClient,
projectId: projectId,
buildId: buildId,
)) {
reported = true;
lastDetail = detail;
yield detail;
}
if (lastDetail != null && _hasBuildEnded(lastDetail.build.status)) {
return;
}
silentTails = reported ? 0 : silentTails + 1;
if (silentTails >= _maxSilentTails) {
return;
}
await Future<void>.delayed(_tailReconnectDelay);
}
}