mirror of
https://github.com/immich-app/immich.git
synced 2026-06-05 06:15:24 -04:00
963862b1b9
* event-based cancellation 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 * abort local sync
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',
|
|
);
|
|
});
|
|
}
|