Skip to content
Merged
Show file tree
Hide file tree
Changes from 2 commits
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: 3 additions & 1 deletion app/lib/package/api_export/api_exporter.dart
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ import 'package:pub_dev/frontend/handlers/atom_feed.dart';
import 'package:pub_dev/service/security_advisories/backend.dart';
import 'package:pub_dev/shared/exceptions.dart';
import 'package:pub_dev/shared/parallel_foreach.dart';
import 'package:pub_dev/task/clock_control.dart';

import '../../search/backend.dart';
import '../../shared/datastore.dart';
Expand Down Expand Up @@ -308,7 +309,8 @@ final class ApiExporter {
seen.removeWhere((_, updated) => updated.isBefore(since));

// Wait until aborted or 10 minutes before scanning again!
await abort.future.timeout(Duration(minutes: 10), onTimeout: () => null);
await abort.future
.timeoutWithClock(Duration(minutes: 10), onTimeout: () => null);
}
}

Expand Down
2 changes: 1 addition & 1 deletion app/lib/service/services.dart
Original file line number Diff line number Diff line change
Expand Up @@ -300,7 +300,7 @@ Future<R> _withPubServices<R>(FutureOr<R> Function() fn) async {

// Create a zone-local flag to indicate that services setup has been completed.
return await fork(
() => Zone.current.fork(zoneValues: {
() async => Zone.current.fork(zoneValues: {
_pubDevServicesInitializedKey: true,
}).run(
() async {
Expand Down
8 changes: 5 additions & 3 deletions app/lib/task/backend.dart
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ import 'package:pub_dev/shared/versions.dart'
acceptedRuntimeVersions;
import 'package:pub_dev/shared/versions.dart' as shared_versions
show runtimeVersion;
import 'package:pub_dev/task/clock_control.dart';
import 'package:pub_dev/task/cloudcompute/cloudcompute.dart';
import 'package:pub_dev/task/global_lock.dart';
import 'package:pub_dev/task/handlers.dart';
Expand Down Expand Up @@ -138,7 +139,7 @@ class TaskBackend {
st,
);
// Sleep 5 minutes to reduce risk of degenerate behavior
await Future.delayed(Duration(minutes: 5));
await clock.delayed(Duration(minutes: 5));
}
}
} catch (e, st) {
Expand Down Expand Up @@ -176,7 +177,7 @@ class TaskBackend {
st,
);
// Sleep 5 minutes to reduce risk of degenerate behavior
await Future.delayed(Duration(minutes: 5));
await clock.delayed(Duration(minutes: 5));
}
}
} catch (e, st) {
Expand Down Expand Up @@ -349,7 +350,8 @@ class TaskBackend {
seen.removeWhere((_, updated) => updated.isBefore(since));

// Wait until aborted or 10 minutes before scanning again!
await abort.future.timeout(Duration(minutes: 10), onTimeout: () => null);
await abort.future
.timeoutWithClock(Duration(minutes: 10), onTimeout: () => null);
}
}

Expand Down
Loading