mirror of
https://github.com/immich-app/immich.git
synced 2026-05-30 19:35:19 -04:00
15f8afbd81
wire hash cancellation await cleanup remove forced kill add regression tests abort sync requests fix cleanup ordering in teardown exit isolate test background sync test sigabrt crash cleanup
24 lines
667 B
Dart
24 lines
667 B
Dart
import 'package:flutter_test/flutter_test.dart';
|
|
import 'package:immich_mobile/wm_executor.dart';
|
|
|
|
void main() {
|
|
tearDown(workerManagerPatch.dispose);
|
|
|
|
test('dispose() drains a cancelled task and delivers its result', () async {
|
|
await workerManagerPatch.init(isolatesCount: 1, dynamicSpawning: false);
|
|
|
|
final task = workerManagerPatch.executeGentle((onCancel) async {
|
|
await onCancel.future;
|
|
return 'drained';
|
|
});
|
|
|
|
await workerManagerPatch.dispose();
|
|
|
|
expect(
|
|
await task.timeout(const Duration(seconds: 5)),
|
|
'drained',
|
|
reason: 'the worker must finish and return its result, not be killed mid-task',
|
|
);
|
|
});
|
|
}
|