mirror of
https://gitlab.com/nkming2/nc-photos.git
synced 2025-02-24 10:28:50 +01:00
Move compute queue onResult callback after removing job
This commit is contained in:
parent
29bc5567b0
commit
d795bfa5ed
1 changed files with 3 additions and 2 deletions
|
@ -19,12 +19,13 @@ class ComputeQueue<T, U> {
|
|||
Future<void> _startProcessing() async {
|
||||
while (_queue.isNotEmpty) {
|
||||
final ev = _queue.first;
|
||||
final U result;
|
||||
try {
|
||||
final result = await compute(ev.callback, ev.message);
|
||||
ev.onResult(result);
|
||||
result = await compute(ev.callback, ev.message);
|
||||
} finally {
|
||||
_queue.removeFirst();
|
||||
}
|
||||
ev.onResult(result);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue