Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions pkg/pub_worker/lib/src/analyze.dart
Original file line number Diff line number Diff line change
Expand Up @@ -205,6 +205,7 @@ Future<void> _analyzePackage(
final r = await retry(
() => api.taskUploadResult(package, version),
retryIf: _retryIf,
delayFactor: Duration(seconds: 5),
);

// Create BlobIndex
Expand Down Expand Up @@ -236,6 +237,7 @@ Future<void> _analyzePackage(
await retry(
() => api.taskUploadFinished(package, version),
retryIf: _retryIf,
delayFactor: Duration(seconds: 5),
);
} finally {
await tempDir.delete(recursive: true);
Expand All @@ -261,6 +263,7 @@ Future<void> _reportPackageSkipped(
final r = await retry(
() => api.taskUploadResult(package, version),
retryIf: _retryIf,
delayFactor: Duration(seconds: 5),
);

final output = await BlobIndexPair.build(r.blobId, (addFile) async {
Expand Down Expand Up @@ -301,6 +304,7 @@ Future<void> _reportPackageSkipped(
await retry(
() => api.taskUploadFinished(package, version),
retryIf: _retryIf,
delayFactor: Duration(seconds: 5),
);
}

Expand Down
11 changes: 9 additions & 2 deletions pkg/pub_worker/lib/src/upload.dart
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,12 @@
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.

import 'dart:async';
import 'dart:io';

import 'package:_pub_shared/data/package_api.dart' show UploadInfo;
import 'package:http/http.dart'
show MultipartRequest, MultipartFile, Client, Response;
show Client, ClientException, MultipartFile, MultipartRequest, Response;
import 'package:http_parser/http_parser.dart' show MediaType;
import 'package:logging/logging.dart' show Logger;
import 'package:meta/meta.dart';
Expand Down Expand Up @@ -60,7 +61,13 @@ Future<void> upload(
throw UploadException(
'Unhandled HTTP status = ${res.statusCode}, body: ${res.body}',
);
}, retryIf: (e) => e is IOException || e is IntermittentUploadException);
},
retryIf: (e) =>
e is IOException ||
e is IntermittentUploadException ||
e is ClientException ||
e is TimeoutException,
delayFactor: Duration(seconds: 5));

@sealed
class UploadException implements Exception {
Expand Down
Loading